);
use File::Temp;
-use Getopt::Long;
+use Getopt::Long qw(:config gnu_getopt no_ignore_case);
use POSIX ':sys_wait_h';
use Pod::Usage;
my $command = shift;
my $status;
- system($command);
+ $status = system($command);
- if (WIFEXITED($?)) {
- $status = WEXITSTATUS($?);
- if ($status != 0) {
- die("$command exited $status");
+ if (WIFEXITED($status)) {
+ if (($status = WEXITSTATUS($status)) != 0) {
+ die("$command exited with status $status");
}
-
- } elsif (WIFSIGNALED($?)) {
- $status = WTERMSIG($?);
- die("$command signalled $status");
-
- } elsif (WIFSTOPPED($?)) {
- $status = WSTOPSIG($?);
- die("$command stopped $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): \$? = $? \$! = $!");
}
$device ||= '/dev/cdrom';
- print"$_\n" for ('cdparanoia', '-d', $device, "1-$trackcount", 'wav');
exec('cdparanoia', '-d', $device, "1-$trackcount", 'wav');
# exec prints its own error message so just
die;