Browse code

Print the container id before the hijack in `docker run` (see also #804)

This is useful when you want to get the container id before you start to
interact with stdin (which is what I'm doing in dotcloud/sandbox).

Louis Opter authored on 2013/06/05 07:24:25
Showing 1 changed files
... ...
@@ -1228,6 +1228,9 @@ func (cli *DockerCli) CmdRun(args ...string) error {
1228 1228
 		return err
1229 1229
 	}
1230 1230
 
1231
+	if !config.AttachStdout && !config.AttachStderr {
1232
+		fmt.Println(out.ID)
1233
+	}
1231 1234
 	if connections > 0 {
1232 1235
 		chErrors := make(chan error, connections)
1233 1236
 		cli.monitorTtySize(out.ID)
... ...
@@ -1262,9 +1265,6 @@ func (cli *DockerCli) CmdRun(args ...string) error {
1262 1262
 			connections -= 1
1263 1263
 		}
1264 1264
 	}
1265
-	if !config.AttachStdout && !config.AttachStderr {
1266
-		fmt.Println(out.ID)
1267
-	}
1268 1265
 	return nil
1269 1266
 }
1270 1267