Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ptyprocess.PtyProcessError raised on close #383

Closed
kristopher-h opened this issue Oct 17, 2016 · 4 comments
Closed

ptyprocess.PtyProcessError raised on close #383

kristopher-h opened this issue Oct 17, 2016 · 4 comments

Comments

@kristopher-h
Copy link
Contributor

I ran into a situation where a ptyprocess.PtyProcessError is raised when trying to close a pty_spawn.spawn object and that is not possible (ptyprocess.ptyprocess.PtyProcessError: Could not terminate the child.). I'm thinking the call to self.ptyproc.close should be wrapped in _wrap_ptyprocess_err? This to avoid having to be aware of ptyprocess exceptions in higher layers.

E.g.:

def close(self, force=True):
    '''This closes the connection with the child application. Note that
    calling close() more than once is valid. This emulates standard Python
    behavior with files. Set force to True if you want to make sure that
    the child is terminated (SIGKILL is sent if the child ignores SIGHUP
    and SIGINT). '''

    self.flush()
    with _wrap_ptyprocess_err():
        # PtyprocessError can be raised if it is not possible to close child process.
        self.ptyproc.close(force=force)
    ...
@takluyver
Copy link
Member

Sounds reasonable. Want to make a PR?

@kristopher-h
Copy link
Contributor Author

Sure thing I can give it a go (will probably take me a couple of days to figure all the ins and outs of github out, setting up the env etc, but that could be fun).

@takluyver
Copy link
Member

Great :-). Let me know if you run into any problems.

@takluyver
Copy link
Member

Fixed by #386

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants