From 4523f77bba9b97925030bcf641584a4a74819178 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 3 Feb 2017 21:54:56 +0000 Subject: 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 --- Debian/Dgit.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Debian/Dgit.pm') 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 "|",@_; -- cgit v1.2.1