Skip to content

Commit

Permalink
Merge pull request #37 from tonistiigi/close-stdin
Browse files Browse the repository at this point in the history
Close stdin after data has been copied
  • Loading branch information
crosbymichael committed Dec 17, 2015
2 parents e489dd8 + ae5c752 commit c4f3b71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ctr/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ var StartCommand = cli.Command{
if state != nil {
term.RestoreTerminal(os.Stdin.Fd(), state)
}
stdin.Close()
}()
for {
e, err := events.Recv()
Expand Down Expand Up @@ -335,6 +336,7 @@ var ExecCommand = cli.Command{
if state != nil {
term.RestoreTerminal(os.Stdin.Fd(), state)
}
stdin.Close()
}()
for {
e, err := events.Recv()
Expand Down
5 changes: 4 additions & 1 deletion io.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c4f3b71

Please sign in to comment.