]> diplodocus.org Git - flac-archive/blobdiff - fa-rip
Need the g (global) flag on that substitution operation.
[flac-archive] / fa-rip
diff --git a/fa-rip b/fa-rip
index 252c2b5303c90c43ac4157123cd8b86cc43ac06f..1a9bc2a10a8e228c2e31f16d01cb59e194d7dba6 100755 (executable)
--- 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;