diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2017-02-03 21:54:56 +0000 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2017-07-18 22:08:43 +0100 |
commit | 4523f77bba9b97925030bcf641584a4a74819178 (patch) | |
tree | 4c0df3f1195bea6dc17d8e7e63eeeecd85123c0b | |
parent | f5c0d33ede8a4c8f1a45ecb57923d66bc694903d (diff) |
Dgit.pm: runcmd: Break out from dgit
Move runcmd into Dgit.pm.
We need to change dgit-repos-server too, but luckily its definition is
essentially equivalent.
No functional change to dgit. dgit-repos-server now prints somewhat
better error messages when subprocesses fail.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rw-r--r-- | Debian/Dgit.pm | 8 | ||||
-rwxr-xr-x | dgit | 6 | ||||
-rwxr-xr-x | infra/dgit-repos-server | 7 |
3 files changed, 7 insertions, 14 deletions
diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index dcecbd1..5b5591d 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -45,7 +45,7 @@ BEGIN { fail ensuredir executable_on_path waitstatusmsg failedcmd_waitstatus failedcmd_report_cmd failedcmd - cmdoutput cmdoutput_errok + runcmd cmdoutput cmdoutput_errok git_rev_parse git_cat_file git_get_ref git_for_each_ref git_for_each_tag_referring is_fast_fwd @@ -276,6 +276,12 @@ sub failedcmd { fail failedcmd_waitstatus(); } +sub runcmd { + debugcmd "+",@_; + $!=0; $?=-1; + failedcmd @_ if system @_; +} + sub cmdoutput_errok { confess Dumper(\@_)." ?" if grep { !defined } @_; debugcmd "|",@_; @@ -493,12 +493,6 @@ sub url_get { our ($dscdata,$dscurl,$dsc,$dsc_checked,$skew_warning_vsn); -sub runcmd { - debugcmd "+",@_; - $!=0; $?=-1; - failedcmd @_ if system @_; -} - sub act_local () { return $dryrun_level <= 1; } sub act_scary () { return !$dryrun_level; } diff --git a/infra/dgit-repos-server b/infra/dgit-repos-server index ec9b2c9..a8b9400 100755 --- a/infra/dgit-repos-server +++ b/infra/dgit-repos-server @@ -303,13 +303,6 @@ sub reject ($) { die "\ndgit-repos-server: reject: $why\n\n"; } -sub runcmd { - debugcmd '+',@_; - $!=0; $?=0; - my $r = system @_; - die (shellquote @_)." $? $!" if $r; -} - sub policyhook { my ($policyallowbits, @polargs) = @_; # => ($exitstatuspolicybitmap); |