gitnexus 1.6.4-rc.50 → 1.6.4-rc.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/setup.js +16 -6
- package/package.json +1 -1
package/dist/cli/setup.js
CHANGED
|
@@ -23,15 +23,25 @@ const execFileAsync = promisify(execFile);
|
|
|
23
23
|
*/
|
|
24
24
|
function resolveGitnexusBin() {
|
|
25
25
|
try {
|
|
26
|
-
const
|
|
27
|
-
const
|
|
26
|
+
const isWin = process.platform === 'win32';
|
|
27
|
+
const cmd = isWin ? 'where' : 'which';
|
|
28
|
+
const output = execFileSync(cmd, ['gitnexus'], {
|
|
28
29
|
encoding: 'utf-8',
|
|
29
30
|
timeout: 5000,
|
|
30
31
|
stdio: ['ignore', 'pipe', 'ignore'],
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
.
|
|
34
|
-
|
|
32
|
+
});
|
|
33
|
+
const lines = output
|
|
34
|
+
.split('\n')
|
|
35
|
+
.map((l) => l.trim())
|
|
36
|
+
.filter(Boolean);
|
|
37
|
+
if (isWin) {
|
|
38
|
+
// On Windows, `where` returns multiple entries (e.g. the POSIX shell
|
|
39
|
+
// script AND the .cmd/.bat wrapper). Prefer the wrapper because
|
|
40
|
+
// child_process.spawn() cannot execute a shell script directly.
|
|
41
|
+
const cmdLine = lines.find((l) => /\.(cmd|bat)$/i.test(l));
|
|
42
|
+
return cmdLine || lines[0] || null;
|
|
43
|
+
}
|
|
44
|
+
return lines[0] || null;
|
|
35
45
|
}
|
|
36
46
|
catch {
|
|
37
47
|
return null;
|
package/package.json
CHANGED