diff options
-rw-r--r-- | Debian/Dgit.pm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index 5c43f02..6854a7c 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -41,7 +41,7 @@ BEGIN { stat_exists link_ltarget hashfile fail ensuredir executable_on_path - waitstatusmsg failedcmd + waitstatusmsg failedcmd_report_cmd failedcmd cmdoutput cmdoutput_errok git_rev_parse git_get_ref git_for_each_ref git_for_each_tag_referring is_fast_fwd @@ -217,6 +217,12 @@ sub waitstatusmsg () { } } +sub failedcmd_report_cmd { + my $intro = shift @_; + $intro //= "failed command"; + { local ($!); printcmd \*STDERR, _us().": $intro:", @_ or die $!; }; +} + sub failedcmd { # Expects $!,$? as set by close - see below. # To use with system(), set $?=-1 first. @@ -229,7 +235,7 @@ sub failedcmd { # success trashed $?==0 system # program failed trashed $? >0 system # syscall failure $! >0 unchanged system - { local ($!); printcmd \*STDERR, _us().": failed command:", @_ or die $!; }; + failedcmd_report_cmd undef, @_; if ($? < 0) { fail "failed to fork/exec: $!"; } elsif ($?) { |