Skip to content
Myr

terminal_unix.go

This file

Path

src/terminal_unix.go

29 lines · 444 bytes · Go

Last changed by

Terminate resize notification when Loop exitsJunegunn Choibefore adoptiondc384af

History of this file

Take it

1//go:build !windows23package fzf45import (6	"context"7	"os"8	"os/signal"9	"syscall"1011	"golang.org/x/sys/unix"12)1314func 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}2122func notifyStop(p *os.Process) {23	pid := p.Pid24	pgid, err := unix.Getpgid(pid)25	if err == nil {26		pid = pgid * -127	}28	unix.Kill(pid, syscall.SIGTSTP)29}