run: cleanup – move "detached" early exit earlier
Since everything else after the `apiClient.ContainerStart` block is under an `if attach` conditional, we can move the "detached" early exit up. Signed-off-by: Laura Brehm <laurabrehm@hey.com>
This commit is contained in:
parent
8431298824
commit
446f36ce58
@ -215,7 +215,14 @@ func runContainer(ctx context.Context, dockerCli command.Cli, runOpts *runOption
|
||||
return toStatusError(err)
|
||||
}
|
||||
|
||||
if attach && config.Tty && dockerCli.Out().IsTerminal() {
|
||||
// Detached mode: wait for the id to be displayed and return.
|
||||
if !attach {
|
||||
// Detached mode
|
||||
<-waitDisplayID
|
||||
return nil
|
||||
}
|
||||
|
||||
if config.Tty && dockerCli.Out().IsTerminal() {
|
||||
if err := MonitorTtySize(ctx, dockerCli, containerID, false); err != nil {
|
||||
_, _ = fmt.Fprintln(stderr, "Error monitoring TTY size:", err)
|
||||
}
|
||||
@ -233,13 +240,6 @@ func runContainer(ctx context.Context, dockerCli command.Cli, runOpts *runOption
|
||||
}
|
||||
}
|
||||
|
||||
// Detached mode: wait for the id to be displayed and return.
|
||||
if !attach {
|
||||
// Detached mode
|
||||
<-waitDisplayID
|
||||
return nil
|
||||
}
|
||||
|
||||
status := <-statusChan
|
||||
if status != 0 {
|
||||
return cli.StatusError{StatusCode: status}
|
||||
|
Loading…
x
Reference in New Issue
Block a user