Debian Codegraph @

src/terminal_unix.go

raw
1 //go:build !windows
2
3 package fzf
4
5 import (
6 "context"
7 "os"
8 "os/signal"
9 "syscall"
10
11 "golang.org/x/sys/unix"
12 )
13
14 func notifyOnResize(ctx context.Context, resizeChan chan<- os.Signal) {
15 signal.Notify(resizeChan, syscall.SIGWINCH)
16 go func() {
17 <-ctx.Done()
18 signal.Stop(resizeChan)
19 }()
20 }
21
22 func notifyStop(p *os.Process) {
23 pid := p.Pid
24 pgid, err := unix.Getpgid(pid)
25 if err == nil {
26 pid = pgid * -1
27 }
28 unix.Kill(pid, syscall.SIGTSTP)
29 }