sub ExecCmd { my ($cmd,$pipe) = @_; my @result; if(defined $pipe) { LogInfo("Executing $cmd"); open PIPE,"| $cmd" or die "Cannot fork command: $!"; local $SIG{PIPE} = sub { die "Failed to execute $cmd" }; print PIPE "0\n"; close PIPE; unshift @result,"PASS"; return \@result; } }