From be382307d3c47fb02b30836be3cea4220058f01a Mon Sep 17 00:00:00 2001 From: merakor Date: Tue, 10 Aug 2021 22:08:26 +0000 Subject: execv: add function to execute stuff quietly unless CPT_VERBOSE is set FossilOrigin-Name: 43b56b2f5daa113cdacc57031ed6aa2f5d6763e03afd333979a0d043dab2e45e --- src/cpt-lib.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cpt-lib.in b/src/cpt-lib.in index 723136e..41daf05 100644 --- a/src/cpt-lib.in +++ b/src/cpt-lib.in @@ -55,6 +55,11 @@ warnv() { warn "$@" } +execv() { + # Redirect the output to /dev/null unless CPT_VERBOSE is set. + if [ "$CPT_VERBOSE" = 1 ]; then "$@"; else "$@" >/dev/null 2>&1; fi +} + die() { # Print a message and exit with '1' (error). log "$1" "$2" "!>" @@ -984,7 +989,7 @@ pkg_fix_deps() { sort -uk1,1 -o depends depends 2>/dev/null ||: # Display a diff of the new dependencies against the old ones. - diff -U 3 "$dep_file" depends 2>/dev/null ||: + execv diff -U 3 "$dep_file" depends 2>/dev/null ||: # Remove the depends file if it is empty. [ -s depends ] || rm -f depends -- cgit v1.2.3