summaryrefslogtreecommitdiff
path: root/Debian
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2023-02-04 14:01:37 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2023-02-04 15:41:12 +0000
commit4c0cc9b00b556c3bbf56c8370c4f5e3b319aff5e (patch)
tree339469cd1988bddd7041db3bdbe0bbec7d42cd89 /Debian
parent7a299b81c55610de8801cd81f4bd512050d3539c (diff)
Suppress unwanted messages from git-rebase.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'Debian')
-rw-r--r--Debian/Dgit.pm17
1 files changed, 16 insertions, 1 deletions
diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm
index f61185d..6168b19 100644
--- a/Debian/Dgit.pm
+++ b/Debian/Dgit.pm
@@ -55,7 +55,8 @@ BEGIN {
must_getcwd executable_on_path
waitstatusmsg failedcmd_waitstatus
failedcmd_report_cmd failedcmd
- runcmd shell_cmd cmdoutput cmdoutput_errok
+ runcmd runcmd_quieten
+ shell_cmd cmdoutput cmdoutput_errok
@git
git_rev_parse changedir_git_toplevel git_cat_file
git_get_ref git_get_symref git_for_each_ref
@@ -397,6 +398,20 @@ sub shell_cmd {
return qw(sh -ec), $first_shell.'; exec "$@"', 'x', @cmd;
}
+# Runs the command in @_, but capturing its stdout and stderr.
+# Prints those to our stderr only if the command fails.
+sub runcmd_quieten {
+ debugcmd "+",@_;
+ $!=0; $?=-1;
+ my @real_cmd = shell_cmd <<'END', @_;
+ set +e; output=$("$@" 2>&1); rc=$?; set -e
+ if [ $rc = 0 ]; then exit 0; fi
+ printf >&2 "%s\n" "$output"
+ exit $rc
+END
+ failedcmd @_ if system @real_cmd;
+}
+
sub cmdoutput_errok {
confess Dumper(\@_)." ?" if grep { !defined } @_;
local $printdebug_when_debuglevel = $debugcmd_when_debuglevel;