# Test error checking for piped system calls # We use 'boom', a non-existent command, for testing. use Test::More qw/no_plan/; use strict; ok_system_call("true"); ok_system_call("true|true"); not_ok_system_call("boom"); not_ok_system_call("boom|boom"); not_ok_system_call("true|boom"); not_ok_system_call("boom|true"); #################################3 sub ok_system_call { my $test = shift; my $expect_success = shift; $expect_success = 1 if not defined $expect_success; my $ok = (system($test) == 0); # my $exit_code = $? >> 8; # diag "exit code was: $exit_code"; return $expect_success ? ok($ok, $test) : ok(!$ok, $test); } sub not_ok_system_call { my $test= shift; return ok_system_call($test,0); }