mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Disable signal catching and enable real posix raw mode
This commit is contained in:
parent
9c3d2b6a4e
commit
3f63b87807
2 changed files with 11 additions and 1 deletions
|
@ -56,6 +56,15 @@ func daemon() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func runCommand(args []string) error {
|
func runCommand(args []string) error {
|
||||||
|
var oldState *term.State
|
||||||
|
var err error
|
||||||
|
if term.IsTerminal(int(os.Stdin.Fd())) && os.Getenv("NORAW") == "" {
|
||||||
|
oldState, err = term.MakeRaw(int(os.Stdin.Fd()))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer term.Restore(int(os.Stdin.Fd()), oldState)
|
||||||
|
}
|
||||||
// FIXME: we want to use unix sockets here, but net.UnixConn doesn't expose
|
// FIXME: we want to use unix sockets here, but net.UnixConn doesn't expose
|
||||||
// CloseWrite(), which we need to cleanly signal that stdin is closed without
|
// CloseWrite(), which we need to cleanly signal that stdin is closed without
|
||||||
// closing the connection.
|
// closing the connection.
|
||||||
|
|
|
@ -15,7 +15,8 @@ void MakeRaw(int fd) {
|
||||||
ioctl(fd, TCGETS, &t);
|
ioctl(fd, TCGETS, &t);
|
||||||
|
|
||||||
t.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON);
|
t.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON);
|
||||||
t.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN);
|
t.c_oflag &= ~OPOST;
|
||||||
|
t.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN | ISIG);
|
||||||
t.c_cflag &= ~(CSIZE | PARENB);
|
t.c_cflag &= ~(CSIZE | PARENB);
|
||||||
t.c_cflag |= CS8;
|
t.c_cflag |= CS8;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue