Skip to content
Draft
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion cli/command/container/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ func runRm(ctx context.Context, dockerCLI command.Cli, opts *rmOptions) error {
for _, name := range opts.containers {
if err := <-errChan; err != nil {
if opts.force && errdefs.IsNotFound(err) {
_, _ = fmt.Fprintln(dockerCLI.Err(), err)
continue
}
errs = append(errs, err)
Expand Down
8 changes: 5 additions & 3 deletions cli/command/container/rm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import (

func TestRemoveForce(t *testing.T) {
for _, tc := range []struct {
name string
args []string
expectedErr string
name string
args []string
expectedErr string
expectedStderr string
}{
{name: "without force", args: []string{"nosuchcontainer", "mycontainer"}, expectedErr: "no such container"},
{name: "with force", args: []string{"--force", "nosuchcontainer", "mycontainer"}, expectedErr: ""},
Expand Down Expand Up @@ -52,6 +53,7 @@ func TestRemoveForce(t *testing.T) {
} else {
assert.NilError(t, err)
}
assert.Equal(t, cli.ErrBuffer().String(), tc.expectedStderr)
sort.Strings(removed)
assert.DeepEqual(t, removed, []string{"mycontainer", "nosuchcontainer"})
})
Expand Down