-
Notifications
You must be signed in to change notification settings - Fork 223
Description
The close documentation states:
Fires when the process has been terminated, with an error or not.
But it does not fire in all cases. It only fires if the exit code is not null.
this.childProcess.on('exit', function (code) {
self.exitCode = code;
terminateIfNeeded();
});
function terminateIfNeeded() {
if (!self.stderrHasEnded || !self.stdoutHasEnded || self.exitCode == null) {
return;
}
// ... code goes on to emit close
}The child_process documentation says:
The 'exit' event is emitted after the child process ends. If the process exited, code is the final exit code of the process, otherwise null. If the process terminated due to receipt of a signal, signal is the string name of the signal, otherwise null. One of the two will always be non-null.
If the process is closed due to a signal the exit code will be null, and therefore the close event will not fire. Either the close documentation should be updated, the logic should be changed, or a new event should be added in for termination via signal.
Thanks for making python-shell, by the way. I've been using it over at https://github.com/Almenon/AREPL