Skip to content

Commit 2d7ad48

Browse files
committed
updated with riku's code
1 parent 6bdaa81 commit 2d7ad48

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

_examples/ssh-docker/docker.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,13 @@ func dockerRun(cfg *container.Config, sess ssh.Session) (status int64, cleanup f
107107
}
108108
}()
109109
}
110-
statusChan, chanErr := docker.ContainerWait(ctx, res.ID, container.WaitConditionNotRunning)
111-
if chanErr != nil {
110+
resultC, errC := docker.ContainerWait(ctx, res.ID, container.WaitConditionNotRunning)
111+
select {
112+
case err = <-errC:
112113
return
114+
case result := <-resultC:
115+
status = result.StatusCode
113116
}
114-
err = <-chanErr
115-
s := <-statusChan
116-
status = s.StatusCode
117+
err = <-outputErr
117118
return
118119
}

0 commit comments

Comments
 (0)