Skip to content

Commit

Permalink
Fix exit code returned by client
Browse files Browse the repository at this point in the history
Fixes a problem introduced with 5c9068a.
  • Loading branch information
okurz committed Apr 25, 2020
1 parent b3f6ea4 commit ae46054
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion script/client
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ if ($options{form} && $options{'json-data'}) {
exit(2);
}

exit OpenQA::Client::run(\%options, @ARGV);
my $ret = OpenQA::Client::run(\%options, @ARGV);
exit(defined $ret ? 0 : 1);

1;
4 changes: 2 additions & 2 deletions t/31-client.t
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ $code = 404;
$code_mock->{error} = {message => 'Not Found'};
sub wrong_call { $ret = OpenQA::Client::run(\%options, qw(unknown)) }
stderr_like \&wrong_call, qr/$code.*Not Found/, 'Error reported';
is $ret, 1, 'exit code shows error';
is $ret, undef, 'undef shows error';
$options{json} = 1;
stderr_like \&wrong_call, qr/$code.*Not Found/, 'Error reported for undocumented "json" parameter';
is $ret, 1, 'exit code shows error';
is $ret, undef, 'undef shows error for undocumented parameter';

done_testing();

0 comments on commit ae46054

Please sign in to comment.