Closed introspection3 closed 11 months ago
5.8.1
18.5
windows ,maybe linux too
x64
node18-win32-x64
file1:s.js---->s.exe console.log(process.argv);
const { spawn,execFile } = require('child_process'); setInterval(() => { console.log(process.argv); }, 10000);
setTimeout(() => { console.log('s.exe','start er.exe'); let argv0=process.argv[0]; let rootPath=require('path').dirname(argv0);
let exePath=require('path').join(rootPath,'er.exe'); console.log('s.exe','exePath='+exePath); startAsync(exePath,rootPath);
}, 5000);
var exec = require('child_process').exec; function startAsync(cmd){
execFile(cmd, function(error, stdout, stderr) { if(error){ console.error(error); } else{ console.log("success"); } });
}
// pkg -t node18-win32-x64 s.js
file2: er.js---->er.exe
console.log(process.argv); const exec = require('child_process').exec; const { spawn,execFile } = require('child_process'); setInterval(() => { console.log('i am er.exe'); }, 10000); function startAsync(cmd){
setTimeout(() => { console.log('er.exe','start s.exe'); let argv0=process.argv[0]; let rootPath=require('path').dirname(argv0);
let exePath=require('path').join(rootPath,'er.exe'); console.log('er.exe','exePath='+exePath); startAsync(exePath,rootPath);
// pkg -t node18-win32-x64 er.js
bug description
s.exe can't call er.exe
can call exe
as above
code.zip souce code
What version of pkg are you using?
5.8.1
What version of Node.js are you using?
18.5
What operating system are you using?
windows ,maybe linux too
What CPU architecture are you using?
x64
What Node versions, OSs and CPU architectures are you building for?
node18-win32-x64
Describe the Bug
file1:s.js---->s.exe console.log(process.argv);
const { spawn,execFile } = require('child_process'); setInterval(() => { console.log(process.argv); }, 10000);
setTimeout(() => { console.log('s.exe','start er.exe'); let argv0=process.argv[0]; let rootPath=require('path').dirname(argv0);
}, 5000);
var exec = require('child_process').exec; function startAsync(cmd){
}
// pkg -t node18-win32-x64 s.js
file2: er.js---->er.exe
console.log(process.argv); const exec = require('child_process').exec; const { spawn,execFile } = require('child_process'); setInterval(() => { console.log('i am er.exe'); }, 10000); function startAsync(cmd){
}
setTimeout(() => { console.log('er.exe','start s.exe'); let argv0=process.argv[0]; let rootPath=require('path').dirname(argv0);
}, 5000);
// pkg -t node18-win32-x64 er.js
bug description
s.exe can't call er.exe
Expected Behavior
can call exe
To Reproduce
as above