FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

close event only emmited upon voluntary exit of program · Issue #94 · extrabacon/python-shell · GitHub

Repository navigation

close event only emmited upon voluntary exit of program #94

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

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL