Skip to content

Commit

Permalink
--help output is not an error
Browse files Browse the repository at this point in the history
  • Loading branch information
guillomovitch committed Jul 16, 2012
1 parent dad5ac2 commit ade6fe5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion fusioninventory-agent
Expand Up @@ -58,7 +58,7 @@ GetOptions(
'stdout',
) or pod2usage(-verbose => 0);

pod2usage(-verbose => 0) if $options->{help};
pod2usage(-verbose => 0, -exitstatus => 0) if $options->{help};

if ($options->{version}) {
print $FusionInventory::Agent::VERSION_STRING . "\n";
Expand Down
2 changes: 1 addition & 1 deletion fusioninventory-injector
Expand Up @@ -91,7 +91,7 @@ GetOptions(
);

$OUTPUT_AUTOFLUSH = 1;
pod2usage() if $options{help};
pod2usage(-verbose => 0, -exitstatus => 0) if $options{help};

if ($options{file}) {
die "file $options{file} does not exist" unless -f $options{file};
Expand Down
12 changes: 6 additions & 6 deletions t/apps/agent.t
Expand Up @@ -15,21 +15,21 @@ use Test::More tests => 32;
my ($content, $out, $err, $rc);

($out, $err, $rc) = run_agent('--help');
ok($rc == 2, '--help exit status');
ok($rc == 0, '--help exit status');
is($err, '', '--help stderr');
like(
$err,
$out,
qr/^Usage:/,
'--help stderr'
'--help stdout'
);
is($out, '', '--help stdin');

($out, $err, $rc) = run_agent('--version');
ok($rc == 0, '--version exit status');
is($err, '', '--version stderr');
like(
$out,
qr/^FusionInventory Agent/,
'--version stdin'
'--version stdout'
);

my $tmpFile = tmpnam();
Expand Down Expand Up @@ -58,7 +58,7 @@ like(
qr/No target defined/,
'no target stderr'
);
is($out, '', 'no target stdin');
is($out, '', 'no target stdout');

my $base_options = "--stdout --debug --no-task ocsdeploy,wakeonlan,snmpquery,netdiscovery";

Expand Down
11 changes: 5 additions & 6 deletions t/apps/injector.t
Expand Up @@ -11,14 +11,13 @@ use Test::More tests => 3;
my ($out, $err, $rc);

($out, $err, $rc) = run_injector('--help');
ok($rc == 2, '--help exit status');
ok($rc == 0, '--help exit status');
is($err, '', '--help stderr');
like(
$err,
qr/^Usage/,
'--help'
$out,
qr/^Usage:/,
'--help stdout'
);
is($out, '', '--help stdin');


sub run_injector {
my ($args) = @_;
Expand Down

0 comments on commit ade6fe5

Please sign in to comment.