Skip to content
Myr

Fix CTRL-Z handling: Signal SIGSTOP to PGID

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix #3501

authored by Junegunn Choi · committed by Junegunn Choi · parent 68db9cb · Browse files · 1 file+8 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−1 removed

  • other:+8 added−1 removed

1 file+8 added−1 removed

modified:src/terminal_unix.go+8 added-1 removed
5 unmodified lines
6 "os"7 "os/signal"8 "strings"9 "syscall"1011 "golang.org/x/sys/unix"12)1314func notifyOnResize(resizeChan chan<- os.Signal) {15 signal.Notify(resizeChan, syscall.SIGWINCH)16}1718func notifyStop(p *os.Process) {17 p.Signal(syscall.SIGSTOP)19 pid := p.Pid20 pgid, err := unix.Getpgid(pid)21 if err == nil {22 pid = pgid * -123 }24 unix.Kill(pid, syscall.SIGSTOP)25}2627func notifyOnCont(resizeChan chan<- os.Signal) {28 signal.Notify(resizeChan, syscall.SIGCONT)
5 unmodified lines