-use POSIX ':sys_wait_h';
-use Pod::Usage;
-
-sub run_or_die {
- my $command = shift;
- my $status;
-
- $status = system($command);
-
- if (WIFEXITED($status)) {
- if (($status = WEXITSTATUS($status)) != 0) {
- die("$command exited with status $status");
- }
- } elsif (WIFSIGNALED($status)) {
- die("$command killed with signal ", WTERMSIG($status));
- } elsif (WIFSTOPPED($status)) {
- die("$command stopped with signal ", WSTOPSIG($status));
- } else {
- die("Major horkage on system($command): \$? = $? \$! = $!");
- }
-}