Skip to content

Commit

Permalink
cmd/retro: enable CTRL-C in raw tty mode
Browse files Browse the repository at this point in the history
  • Loading branch information
db47h committed Aug 16, 2016
1 parent 87d1dab commit 4d3d73d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/retro/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ func port1Handler(i *vm.Instance, v, port vm.Cell) error {
}
// if v == 1, this will always read something
e := i.Wait(v, port)
// in raw tty mode, we need to handle CTRL-D ourselves
if e == nil && i.Ports[1] == 4 {
// CTRL-D
return io.EOF
}
return e
Expand Down
6 changes: 3 additions & 3 deletions cmd/retro/term.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ func setRawIO() (func(), error) {
return nil, err
}
a := tios
a.Iflag &^= syscall.BRKINT | syscall.ISTRIP | syscall.IXON | syscall.IXOFF
a.Iflag |= syscall.IGNBRK | syscall.IGNPAR
a.Lflag &^= syscall.ICANON | syscall.ISIG | syscall.IEXTEN | syscall.ECHO
a.Iflag &^= syscall.IGNBRK | syscall.ISTRIP | syscall.IXON | syscall.IXOFF
a.Iflag |= syscall.BRKINT | syscall.IGNPAR
a.Lflag &^= syscall.ICANON | syscall.IEXTEN | syscall.ECHO
a.Cc[syscall.VMIN] = 1
a.Cc[syscall.VTIME] = 0
err = termios.Tcsetattr(0, termios.TCSANOW, &a)
Expand Down

0 comments on commit 4d3d73d

Please sign in to comment.