From 0e0b5324699342601ce1b9a97c0a2e1faf6fe7ff Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Mon, 30 Jun 2014 14:11:10 -0500 Subject: [PATCH] format-subst.pl: check for subcommand failure Thanks to karl.richter722@gmail.com for reporting the problem. Signed-off-by: Rob Browning Tested-by: Rob Browning --- format-subst.pl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/format-subst.pl b/format-subst.pl index e91c3b8..8a331bf 100755 --- a/format-subst.pl +++ b/format-subst.pl @@ -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; } -- 2.39.2