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

Send SIGHUP to the process group in the terminal, not just the leader #38

Merged
merged 1 commit into from
Nov 15, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion terminado/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ def resize_to_smallest(self):
self.ptyproc.setwinsize(minrows, mincols)

def kill(self, sig=signal.SIGTERM):
"""Send a signal to the process in the pty"""
self.ptyproc.kill(sig)

def killpg(self, sig=signal.SIGTERM):
"""Send a signal to the process group of the process in the pty"""
pgid = os.getpgid(self.ptyproc.pid)
os.killpg(pgid, sig)

@gen.coroutine
def terminate(self, force=False):
Expand Down Expand Up @@ -262,7 +268,7 @@ def client_disconnected(self, websocket):
"""Send terminal SIGHUP when client disconnects."""
self.log.info("Websocket closed, sending SIGHUP to terminal.")
if websocket.terminal:
websocket.terminal.kill(signal.SIGHUP)
websocket.terminal.killpg(signal.SIGHUP)


class NamedTermManager(TermManagerBase):
Expand Down