diff --git a/index.js b/index.js index 2482a71..8a8c2b3 100644 --- a/index.js +++ b/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, // { currentBranch, filter, ].join(' '); - const str = execSync(cmd).toString().trim(); + const str = execSync(cmd, execOptions).toString().trim(); if (!str) return null; const diffMap = {}; const diffArray = str.split('\n');