Skip to content

Commit

Permalink
Merge pull request #38 from takluyver/sighup-pg
Browse files Browse the repository at this point in the history
Send SIGHUP to the process group in the terminal, not just the leader
  • Loading branch information
takluyver authored Nov 15, 2017
2 parents bb1d7b2 + 5780329 commit e419aba
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit e419aba

Please sign in to comment.