-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected] for the project I'm working on.
Normally we won't need to add windowsHide explicitly like this because we are normally executing in a VSCode or cmd or other visible terminal already. However if using pm2 during development, there is officially no visible terminal, triggering five cmd popups that execute and close with no explanation, but interfere with developer keystrokes while working. In such cases, npm modules should be having windowsHide set when they spool up child processes to prevent spurious cmd windows from popping.
I would suggest changes like this:
diff --git a/node_modules/last-commit-log/index.js b/node_modules/last-commit-log/index.js
index 2482a71..edfd7f1 100644
--- a/node_modules/last-commit-log/index.js
+++ b/node_modules/last-commit-log/index.js
@@ -5,6 +5,12 @@ const path = require('path');
const dotgitconfig = require('dotgitconfig');
const { execSync } = require('child_process');
+/**
+ * Prevents obnoxious cmd window popping up on Windows when process runs via pm2 instead of via an already visible terminal.
+ */
+const baseExecOptions = { windowsHide: true };
+
module.exports = class LCL {
constructor(dir = process.cwd()) {
this.gitDirStr = '';
@@ -38,6 +44,7 @@ module.exports = class LCL {
let gitTag;
try {
const opts = {
+ ...baseExecOptions,
cwd: this.cwd,
maxBuffer: 1024 * 1024 * 1024,
// <https://stackoverflow.com/a/45578119
@@ -112,7 +119,7 @@ module.exports = class LCL {
}
getUserNameSync() {
- return execSync(`git ${this.gitDirStr} config user.name`)
+ return execSync(`git ${this.gitDirStr} config user.name`, baseExecOptions)
.toString()
.trim();
}This issue body was partially generated by patch-package.
Metadata
Metadata
Assignees
Labels
No labels