Browse code

Fix stale command with stdout is not allocated

Guillaume J. Charmes authored on 2013/06/04 09:39:29
Showing 1 changed files
... ...
@@ -355,6 +355,17 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s
355 355
 				errors <- err
356 356
 			}()
357 357
 		}
358
+	} else {
359
+		go func() {
360
+			defer stdinCloser.Close()
361
+
362
+			cStdout, err := container.StdoutPipe()
363
+			if err != nil {
364
+				utils.Debugf("Error stdout pipe")
365
+				return
366
+			}
367
+			io.Copy(&utils.NopWriter{}, cStdout)
368
+		}()
358 369
 	}
359 370
 	if stderr != nil {
360 371
 		nJobs += 1
... ...
@@ -381,7 +392,19 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s
381 381
 				errors <- err
382 382
 			}()
383 383
 		}
384
+	} else {
385
+		go func() {
386
+			defer stdinCloser.Close()
387
+
388
+			cStderr, err := container.StdoutPipe()
389
+			if err != nil {
390
+				utils.Debugf("Error stdout pipe")
391
+				return
392
+			}
393
+			io.Copy(&utils.NopWriter{}, cStderr)
394
+		}()
384 395
 	}
396
+
385 397
 	return utils.Go(func() error {
386 398
 		if cStdout != nil {
387 399
 			defer cStdout.Close()