File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed
Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -48,16 +48,15 @@ func dockerMain() int {
4848 otel .SetErrorHandler (debug .OTELErrorHandler )
4949
5050 if err := runDocker (ctx , dockerCli ); err != nil {
51- if sterr , ok := err .(cli.StatusError ); ok {
52- if sterr .Status != "" {
53- fmt .Fprintln (dockerCli .Err (), sterr .Status )
54- }
51+ var stErr cli.StatusError
52+ if errors .As (err , & stErr ) {
5553 // StatusError should only be used for errors, and all errors should
5654 // have a non-zero exit status, so never exit with 0
57- if sterr .StatusCode == 0 {
58- return 1
55+ if stErr .StatusCode == 0 { // FIXME(thaJeztah): StatusCode should never be used with a zero status-code. Check if we do this anywhere.
56+ stErr . StatusCode = 1
5957 }
60- return sterr .StatusCode
58+ _ , _ = fmt .Fprintln (dockerCli .Err (), stErr )
59+ return stErr .StatusCode
6160 }
6261 if errdefs .IsCancelled (err ) {
6362 return 0
Original file line number Diff line number Diff line change @@ -203,7 +203,7 @@ func TestPluginSocketCommunication(t *testing.T) {
203203
204204 // the plugin does not get signalled, but it does get its
205205 // context canceled by the CLI through the socket
206- const expected = "test-socket: exiting after context was done"
206+ const expected = "test-socket: exiting after context was done\n exit status 2 "
207207 actual := strings .TrimSpace (string (out ))
208208 assert .Check (t , is .Equal (actual , expected ))
209209 })
You can’t perform that action at this time.
0 commit comments