X-Git-Url: https://diplodocus.org/git/flac-archive/blobdiff_plain/c47f24178a0ff695262801bf9ca9b0efc9fa56e6..d5d85722f4fb0fc6ca61102b397aa51a96bddcc6:/fa-rip diff --git a/fa-rip b/fa-rip index 252c2b5..1a9bc2a 100755 --- a/fa-rip +++ b/fa-rip @@ -21,7 +21,7 @@ use Env qw( ); use File::Temp; -use Getopt::Long; +use Getopt::Long qw(:config gnu_getopt no_ignore_case); use POSIX ':sys_wait_h'; use Pod::Usage; @@ -31,22 +31,16 @@ sub run_or_die { 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): \$? = $? \$! = $!"); } @@ -137,7 +131,6 @@ sub rip { $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;