X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=Debian%2FDgit.pm;h=6854a7cffd74dff3ae7a7d236d41cb5c42fc4088;hb=37913654d58e03354aa4d5a6aa5afb9c5aeca6b7;hp=5c43f0257b82860f0e6cff3e7d85040c144cd8df;hpb=c7821c26c30b0a79658b626ee7f2a17f73cdc952;p=dgit.git diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index 5c43f025..6854a7cf 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 ($?) {