Fix the attach behavior with -i
Victor Vieux authored on 2013/09/30 19:29:19... | ... |
@@ -478,13 +478,11 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s |
478 | 478 |
utils.Debugf("[start] attach stdout\n") |
479 | 479 |
defer utils.Debugf("[end] attach stdout\n") |
480 | 480 |
// If we are in StdinOnce mode, then close stdin |
481 |
- if container.Config.StdinOnce { |
|
482 |
- if stdin != nil { |
|
483 |
- defer stdin.Close() |
|
484 |
- } |
|
485 |
- if stdinCloser != nil { |
|
486 |
- defer stdinCloser.Close() |
|
487 |
- } |
|
481 |
+ if container.Config.StdinOnce && stdin != nil { |
|
482 |
+ defer stdin.Close() |
|
483 |
+ } |
|
484 |
+ if stdinCloser != nil { |
|
485 |
+ defer stdinCloser.Close() |
|
488 | 486 |
} |
489 | 487 |
_, err := io.Copy(stdout, cStdout) |
490 | 488 |
if err != nil { |
... | ... |
@@ -516,13 +514,11 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s |
516 | 516 |
utils.Debugf("[start] attach stderr\n") |
517 | 517 |
defer utils.Debugf("[end] attach stderr\n") |
518 | 518 |
// If we are in StdinOnce mode, then close stdin |
519 |
- if container.Config.StdinOnce { |
|
520 |
- if stdin != nil { |
|
521 |
- defer stdin.Close() |
|
522 |
- } |
|
523 |
- if stdinCloser != nil { |
|
524 |
- defer stdinCloser.Close() |
|
525 |
- } |
|
519 |
+ if container.Config.StdinOnce && stdin != nil { |
|
520 |
+ defer stdin.Close() |
|
521 |
+ } |
|
522 |
+ if stdinCloser != nil { |
|
523 |
+ defer stdinCloser.Close() |
|
526 | 524 |
} |
527 | 525 |
_, err := io.Copy(stderr, cStderr) |
528 | 526 |
if err != nil { |