From 91c6e16780724fc68bcb58411057ae3ad484862a Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Sun, 25 May 2008 22:25:50 +0000 Subject: Add a new helper function: CT_DoExecLog. It is similar to CT_DoLog, but instead of printing its arguments, it uses them as a command, and logs the output of that command. /trunk/scripts/functions | 8 8 0 0 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/functions b/scripts/functions index 09625ac..0e73143 100644 --- a/scripts/functions +++ b/scripts/functions @@ -105,6 +105,14 @@ CT_DoLog() { return 0 } +# Execute an action, and log its messages +# Usage: CT_DoExecLog <[VAR=val...] command [parameters...]> +CT_DoExecLog() { + local level="$1" + shift + eval "$@" 2>&1 |CT_DoLog "${level}" +} + # Tail message to be logged whatever happens # Usage: CT_DoEnd CT_DoEnd() -- cgit v0.10.2-6-g49f6