Make sure to close the pipe upon ctrl-d
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
This commit is contained in:
parent
d358a4498d
commit
32caa8e018
|
@ -99,7 +99,10 @@ func execCommand(container *libcontainer.Container, tty bool, args []string) (in
|
||||||
}
|
}
|
||||||
defer term.RestoreTerminal(os.Stdin.Fd(), state)
|
defer term.RestoreTerminal(os.Stdin.Fd(), state)
|
||||||
} else {
|
} else {
|
||||||
go io.Copy(inPipe, os.Stdin)
|
go func() {
|
||||||
|
defer inPipe.Close()
|
||||||
|
io.Copy(inPipe, os.Stdin)
|
||||||
|
}()
|
||||||
go io.Copy(os.Stdout, outPipe)
|
go io.Copy(os.Stdout, outPipe)
|
||||||
go io.Copy(os.Stderr, errPipe)
|
go io.Copy(os.Stderr, errPipe)
|
||||||
}
|
}
|
||||||
|
@ -109,6 +112,7 @@ func execCommand(container *libcontainer.Container, tty bool, args []string) (in
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return command.ProcessState.Sys().(syscall.WaitStatus).ExitStatus(), nil
|
return command.ProcessState.Sys().(syscall.WaitStatus).ExitStatus(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue