mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Make sure the ID is displayed usgin run -d
This commit is contained in:
parent
cd0f22ef72
commit
bd144a64f6
1 changed files with 11 additions and 1 deletions
12
commands.go
12
commands.go
|
@ -1278,9 +1278,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 {
|
||||||
|
@ -1309,6 +1315,10 @@ func (cli *DockerCli) CmdRun(args ...string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !config.AttachStdout && !config.AttachStderr {
|
||||||
|
<-wait
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue