Merge pull request #484 from ripcurld0/ps_exit_1

When nothing found in stack exit with exit code 1
This commit is contained in:
Daniel Nephin 2017-08-31 17:13:00 -04:00 committed by GitHub
commit 5a9bf7f359
2 changed files with 3 additions and 4 deletions

View File

@ -57,8 +57,7 @@ func runPS(dockerCli command.Cli, options psOptions) error {
}
if len(tasks) == 0 {
fmt.Fprintf(dockerCli.Err(), "Nothing found in stack: %s\n", namespace)
return nil
return fmt.Errorf("nothing found in stack: %s", namespace)
}
format := options.format

View File

@ -60,9 +60,9 @@ func TestStackPsEmptyStack(t *testing.T) {
cmd := newPsCommand(fakeCli)
cmd.SetArgs([]string{"foo"})
assert.NoError(t, cmd.Execute())
assert.Error(t, cmd.Execute())
assert.EqualError(t, cmd.Execute(), "nothing found in stack: foo")
assert.Equal(t, "", fakeCli.OutBuffer().String())
assert.Equal(t, "Nothing found in stack: foo\n", fakeCli.ErrBuffer().String())
}
func TestStackPsWithQuietOption(t *testing.T) {