Skip to content
Myr

tty_unix.go

This file

Path

tty_unix.go

47 lines · 1.1 KiB · Go

Last changed by

fix: add missing signal.Stop in suspendProcess to prevent signal channel leak (Closes #1673) (#1674)Cocoon-Breakbefore adoption729f05c

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–22why, 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 "fmt"8 "os"9 "os/signal"10 "syscall"1112 "github.com/charmbracelet/x/term"13)1415func (p *Program) initInput() (err error) {16 // Check if input is a terminal17 if f, ok := p.input.(term.File); ok && term.IsTerminal(f.Fd()) {18 p.ttyInput = f19 p.previousTtyInputState, err = term.MakeRaw(p.ttyInput.Fd())20 if err != nil {21 return fmt.Errorf("error entering raw mode: %w", err)22 }

Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97

lines 23–27why, one step back
23
24 // OPTIM: We can use hard tabs and backspaces to optimize cursor25 // movements. This is based on termios settings support and whether26 // they exist and enabled.27 p.checkOptimizedMovements(p.previousTtyInputState)

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

lines 28–42why, one step back
28 }
2930 if f, ok := p.output.(term.File); ok && term.IsTerminal(f.Fd()) {31 p.ttyOutput = f32 }3334 return nil35}3637const suspendSupported = true3839// Send SIGTSTP to the entire process group.40func suspendProcess() {41 c := make(chan os.Signal, 1)42 signal.Notify(c, syscall.SIGCONT)

fix: add missing signal.Stop in suspendProcess to prevent signal channel leak (Closes #1673) (#1674)Cocoon-Breakbefore adoption729f05c

line 43why, one step back
43 defer signal.Stop(c)

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

lines 44–47why, one step back
44 _ = syscall.Kill(0, syscall.SIGTSTP)
45 // blocks until a CONT happens...46 <-c47}