diff options
author | merakor <cem@ckyln.com> | 2021-08-10 22:08:26 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2021-08-10 22:08:26 +0000 |
commit | be382307d3c47fb02b30836be3cea4220058f01a (patch) | |
tree | c6e157ac365c41f2df94a36d977f6af7ac5c7bab | |
parent | 683c2f54835533c980db3e6741ed369bf899d610 (diff) | |
download | cpt-be382307d3c47fb02b30836be3cea4220058f01a.tar.gz |
execv: add function to execute stuff quietly unless CPT_VERBOSE is set
FossilOrigin-Name: 43b56b2f5daa113cdacc57031ed6aa2f5d6763e03afd333979a0d043dab2e45e
-rw-r--r-- | src/cpt-lib.in | 7 |
1 files changed, 6 insertions, 1 deletions
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 |