diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2023-11-04 13:46:29 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2023-11-04 13:46:29 +0900 |
commit | 70c19ccf16a0f8ef2d0ef8ef44f69dd72aa210b1 (patch) | |
tree | ab3ef0ac2e38f04a48769b52656680034218fc31 | |
parent | 68db9cb499ab32190edae6c285942c5fb7cf39ed (diff) |
Fix CTRL-Z handling: Signal SIGSTOP to PGID
Fix #3501
-rw-r--r-- | src/terminal_unix.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/terminal_unix.go b/src/terminal_unix.go index 4cee73b0..1ce7854e 100644 --- a/src/terminal_unix.go +++ b/src/terminal_unix.go @@ -7,6 +7,8 @@ import ( "os/signal" "strings" "syscall" + + "golang.org/x/sys/unix" ) func notifyOnResize(resizeChan chan<- os.Signal) { @@ -14,7 +16,12 @@ func notifyOnResize(resizeChan chan<- os.Signal) { } func notifyStop(p *os.Process) { - p.Signal(syscall.SIGSTOP) + pid := p.Pid + pgid, err := unix.Getpgid(pid) + if err == nil { + pid = pgid * -1 + } + unix.Kill(pid, syscall.SIGSTOP) } func notifyOnCont(resizeChan chan<- os.Signal) { |