@codemoreira/esad 1.4.6-33 → 1.4.6-34
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/package.json +1 -1
- package/src/cli/utils/process.js +14 -8
package/package.json
CHANGED
package/src/cli/utils/process.js
CHANGED
|
@@ -18,7 +18,6 @@ const runProcess = (cmd, args, cwd = process.cwd()) => {
|
|
|
18
18
|
fn(arg);
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
// Try to find a local binary in node_modules/.bin first
|
|
22
21
|
const isWin = process.platform === 'win32';
|
|
23
22
|
const localBinPath = path.join(cwd, 'node_modules', '.bin', isWin ? `${cmd}.cmd` : cmd);
|
|
24
23
|
|
|
@@ -26,22 +25,29 @@ const runProcess = (cmd, args, cwd = process.cwd()) => {
|
|
|
26
25
|
let finalArgs = args;
|
|
27
26
|
|
|
28
27
|
if (fs.existsSync(localBinPath)) {
|
|
29
|
-
|
|
28
|
+
// Use RELATIVE path for Windows stability
|
|
29
|
+
command = isWin ? `node_modules\\.bin\\${cmd}.cmd` : `./node_modules/.bin/${cmd}`;
|
|
30
30
|
} else {
|
|
31
|
-
|
|
32
|
-
command = isWin ? 'npx.cmd' : 'npx';
|
|
33
|
-
finalArgs = [cmd, ...args];
|
|
31
|
+
command = isWin ? `${cmd}.cmd` : cmd;
|
|
34
32
|
}
|
|
33
|
+
|
|
34
|
+
console.log(`[ESAD] Resolved Command: ${command} (CWD: ${cwd})`);
|
|
35
35
|
|
|
36
|
-
const child = spawn(command, finalArgs, {
|
|
36
|
+
const child = spawn(command, finalArgs, {
|
|
37
|
+
stdio: 'inherit',
|
|
38
|
+
cwd,
|
|
39
|
+
shell: true
|
|
40
|
+
});
|
|
37
41
|
|
|
38
42
|
child.on('error', err => {
|
|
39
|
-
|
|
43
|
+
// Log more details to understand when this happens
|
|
44
|
+
console.error(`[ESAD] Process Error: ${err.code} - ${err.message}`);
|
|
45
|
+
finalize(reject, new Error(`Failed to start ${cmd}: ${err.message}`));
|
|
40
46
|
});
|
|
41
47
|
|
|
42
48
|
child.on('close', code => {
|
|
43
49
|
if (code !== 0) {
|
|
44
|
-
finalize(reject, new Error(`
|
|
50
|
+
finalize(reject, new Error(`Process ${cmd} exited with code ${code}`));
|
|
45
51
|
} else {
|
|
46
52
|
finalize(resolve);
|
|
47
53
|
}
|