]> arthur.barton.de Git - bup.git/commitdiff
format-subst.pl: check for subcommand failure
authorRob Browning <rlb@defaultvalue.org>
Mon, 30 Jun 2014 19:11:10 +0000 (14:11 -0500)
committerRob Browning <rlb@defaultvalue.org>
Mon, 30 Jun 2014 19:11:16 +0000 (14:11 -0500)
Thanks to karl.richter722@gmail.com for reporting the problem.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
format-subst.pl

index e91c3b8ad7f8cf23c5ca660ba1ca13db2e3ce3b2..8a331bff2942008869476064f603feac82fbcbe1 100755 (executable)
@@ -8,18 +8,25 @@ sub fix($) {
     return $s;
 }
 
+sub ex
+{
+  my ($cmd) = @_;
+  my $result = `$cmd` or die 'FAILED: ' . $cmd;
+  return $result;
+}
+
 while (<>) {
     s{
        \$Format:\%d\$
     }{
-       my $tag = fix(`git describe --match="[0-9]*"`);
+       my $tag = fix(ex('git describe --match="[0-9]*"'));
        "(tag: bup-$tag)"
     }ex;
     
     s{ 
        \$Format:([^\$].*)\$
     }{
-       fix(`git log -1 --pretty=format:"$1"`)
+       fix(ex("git log -1 --pretty=format:'$1'"))
     }ex;
     print;
 }