-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Closed
Description
Issue Details
- Electron Version:
- 9.2.1
- 10.1.1
- Operating System:
- Windows 64 and 32
- Last Known Working Electron version:
- 8.5.1
With version 9.2.1 and 10.1.1 it happens that sometimes the child_process.exec callback is never called. It seems fine with version 8.5.1 (still testing)
We have this code that sometimes doesn't call the callback, meaning it never print 'finished' on Windows 32 and 64bits.
const exec = require('child_process').exec;
const execPromise = (cmd, execOpts) => {
return new Promise(function(resolve, reject) {
console.log('start')
exec(cmd, execOpts, (error, stdout, stderr) => {
console.log('finished')
if (error) {
error.stdout = stdout;
error.stderr = stderr
reject(error);
return;
}
resolve({stdout: stdout, stderr: stderr});
});
});
}
The command we exec is a Java command and we can see from the task manager the shell process is created and also the Java process, most of the times everything works as expected but sometimes we can see the processes disappearing from the task manager and the callback is not called (finished is never printed in the console), causing a major issue with our application because we are not able to notify the user that the task has finished.
- Again, we see the processes disappearing from the task manager and the callback doesn't print anything
- It seems to be Windows specific, on Linux it doesn't happen.
- It's shouldn't be related to the cmd, it's always the same command with different args and, anyway, I'd expect the callback with an error if there's something wrong with cmd.
- It usually happens every 4 or 5 executions
- We downgraded to version 8.5.1 and it seems there issue is not there, we can run 20 tasks one after the other and we don't experience any issue
- Same thing happens with
util.promisify
of the require('child_process').exec;
Any idea?
hatton