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 {
48
48
otel .SetErrorHandler (debug .OTELErrorHandler )
49
49
50
50
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 ) {
55
53
// StatusError should only be used for errors, and all errors should
56
54
// 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
59
57
}
60
- return sterr .StatusCode
58
+ _ , _ = fmt .Fprintln (dockerCli .Err (), stErr )
59
+ return stErr .StatusCode
61
60
}
62
61
if errdefs .IsCancelled (err ) {
63
62
return 0
Original file line number Diff line number Diff line change @@ -203,7 +203,7 @@ func TestPluginSocketCommunication(t *testing.T) {
203
203
204
204
// the plugin does not get signalled, but it does get its
205
205
// 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 "
207
207
actual := strings .TrimSpace (string (out ))
208
208
assert .Check (t , is .Equal (actual , expected ))
209
209
})
You can’t perform that action at this time.
0 commit comments