Skip to content

Commit

Permalink
Fix suspending with process groups (#49)
Browse files Browse the repository at this point in the history
Since using raw mode via `raw.lflag &= ~(… | termios.ISIG)` pyrepl needs
to handle SIGSTOP itself, but before this patch would only signal its
own process.
Using `0` for the pid signals the process group instead.

Manual test:

When running the following from a shell `Ctrl-z` will not give you the
shell's prompt, but the process is stuck, and needs to be signaled to
continue using `kill -CONT $pid`:

> python -c 'import os; os.system("python pyrepl/reader.py")'

I have noticed this when using pdbpp with pytest, which was wrapped in a
shell script, not using `exec python …`.
  • Loading branch information
blueyed authored May 21, 2022
1 parent f1e5513 commit ca192a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pyrepl/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def do(self):
r = self.reader
p = r.pos
r.console.finish()
os.kill(os.getpid(), signal.SIGSTOP)
os.kill(0, signal.SIGSTOP)
## this should probably be done
## in a handler for SIGCONT?
r.console.prepare()
Expand Down

0 comments on commit ca192a8

Please sign in to comment.