mirror of https://github.com/docker/docs.git
Merge pull request #1046 from dotcloud/1043-output_id_non_attach-fix
- Runtime: Make sure the ID is displayed usgin run -d
This commit is contained in:
commit
79ee8b46f4
12
commands.go
12
commands.go
|
@ -1285,9 +1285,15 @@ func (cli *DockerCli) CmdRun(args ...string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var wait chan struct{}
|
||||||
|
|
||||||
if !config.AttachStdout && !config.AttachStderr {
|
if !config.AttachStdout && !config.AttachStderr {
|
||||||
// Make this asynchrone in order to let the client write to stdin before having to read the ID
|
// Make this asynchrone in order to let the client write to stdin before having to read the ID
|
||||||
go fmt.Fprintf(cli.out, "%s\n", runResult.ID)
|
wait = make(chan struct{})
|
||||||
|
go func() {
|
||||||
|
defer close(wait)
|
||||||
|
fmt.Fprintf(cli.out, "%s\n", runResult.ID)
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.AttachStdin || config.AttachStdout || config.AttachStderr {
|
if config.AttachStdin || config.AttachStdout || config.AttachStderr {
|
||||||
|
@ -1316,6 +1322,10 @@ func (cli *DockerCli) CmdRun(args ...string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !config.AttachStdout && !config.AttachStderr {
|
||||||
|
<-wait
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue