Skip to content
Myr

signals_unix.go

This file

Path

signals_unix.go

33 lines · 662 bytes · Go

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than 3dfbcd9 point at it.

feat(render): skipping lines from previous frameKonstantin Antonovbefore adoption3dfbcd9

lines 1–33why, one step back
1//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || aix || zos
2// +build darwin dragonfly freebsd linux netbsd openbsd solaris aix zos34package tea56import (7 "os"8 "os/signal"9 "syscall"10)1112// listenForResize sends messages (or errors) when the terminal resizes.13// Argument output should be the file descriptor for the terminal; usually14// os.Stdout.15func (p *Program) listenForResize(done chan struct{}) {16 sig := make(chan os.Signal, 1)17 signal.Notify(sig, syscall.SIGWINCH)1819 defer func() {20 signal.Stop(sig)21 close(done)22 }()2324 for {25 select {26 case <-p.ctx.Done():27 return28 case <-sig:29 }3031 p.checkResize()32 }33}