Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cmd/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ func main() {
}

if err != nil && !errdefs.IsCancelled(err) {
_, _ = fmt.Fprintln(os.Stderr, err)
var stErr cli.StatusError
if errors.As(err, &stErr) && stErr.Status != "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is filtering all non-StatusErrors now 😅 I think it needs to be something like this:

Suggested change
if errors.As(err, &stErr) && stErr.Status != "" {
if !errors.As(err, &stErr) || stErr.Status != "" {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch; this looked plausible at first glance as it was identical to the removed code, but at this spot in the code we need to adjust the conditional.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this isn't quite it, as we seem to have actually added the exit status as expected to some tests. I'll probably have to spend a bit of time figuring out how much of that is intended/what the expected behavior is here.

I suspect it is to print 'exit status Y' for CLI plugins, but not for attach/exec; however that might require a new type as both current are a StatusError...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take a look at it soon.
After a quick look, we shouldn't update the code here. We'll break too many other things in the process.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@neersighted please see this PR #5854

_, _ = fmt.Fprintln(os.Stderr, err)
}
os.Exit(getExitCode(err))
}
}
Expand Down
Loading