Skip to content

Commit

Permalink
close
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn committed Jul 22, 2024
1 parent 780064d commit 17a02dd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tty_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,18 @@ func (tty *TTY) readRune() (rune, error) {
}

func (tty *TTY) close() error {
if tty.out == nil {
return nil
}
signal.Stop(tty.ss)
close(tty.ss)
return unix.IoctlSetTermios(int(tty.in.Fd()), ioctlWriteTermios, &tty.termios)
err1 := unix.IoctlSetTermios(int(tty.in.Fd()), ioctlWriteTermios, &tty.termios)
err2 := tty.out.Close()
tty.out = nil
if err1 != nil {
return err1
}
return err2
}

func (tty *TTY) size() (int, int, error) {
Expand Down

0 comments on commit 17a02dd

Please sign in to comment.