Skip to content

Commit

Permalink
Fix ctrl-Z handling
Browse files Browse the repository at this point in the history
To correctly mimic the behavior of a terminal we need to send SIGTSTP
to the whole foreground process group, instead of just sending it to
ourselves.

Fixes go-delve/delve#3605
  • Loading branch information
aarzilli committed Dec 27, 2023
1 parent d32d89d commit 87606e6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions signal_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
)

func handleCtrlZ() {
p, err := os.FindProcess(os.Getpid())
pid := os.Getpid()
pgrp, err := syscall.Getpgid(pid)
if err == nil {
p.Signal(syscall.SIGTSTP)
syscall.Kill(-pgrp, syscall.SIGTSTP)
}
}

0 comments on commit 87606e6

Please sign in to comment.