Merge pull request #37 from tonistiigi/close-stdin

Close stdin after data has been copied
This commit is contained in:
Michael Crosby 2015-12-17 13:43:34 -08:00
commit c4f3b71344
2 changed files with 6 additions and 1 deletions

View File

@ -131,6 +131,7 @@ var StartCommand = cli.Command{
if state != nil {
term.RestoreTerminal(os.Stdin.Fd(), state)
}
stdin.Close()
}()
for {
e, err := events.Recv()
@ -335,6 +336,7 @@ var ExecCommand = cli.Command{
if state != nil {
term.RestoreTerminal(os.Stdin.Fd(), state)
}
stdin.Close()
}()
for {
e, err := events.Recv()

5
io.go
View File

@ -25,7 +25,10 @@ func newCopier(i *ioConfig) (*copier, error) {
return nil, err
}
l.closers = append(l.closers, f)
go io.Copy(i.Stdin, f)
go func() {
io.Copy(i.Stdin, f)
i.Stdin.Close()
}()
}
if i.StdoutPath != "" {
f, err := os.OpenFile(i.StdoutPath, os.O_RDWR, 0)