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(+)
1.1 --- a/scripts/functions Sun May 25 22:23:29 2008 +0000
1.2 +++ b/scripts/functions Sun May 25 22:25:50 2008 +0000
1.3 @@ -105,6 +105,14 @@
1.4 return 0
1.5 }
1.6
1.7 +# Execute an action, and log its messages
1.8 +# Usage: CT_DoExecLog <level> <[VAR=val...] command [parameters...]>
1.9 +CT_DoExecLog() {
1.10 + local level="$1"
1.11 + shift
1.12 + eval "$@" 2>&1 |CT_DoLog "${level}"
1.13 +}
1.14 +
1.15 # Tail message to be logged whatever happens
1.16 # Usage: CT_DoEnd <level>
1.17 CT_DoEnd()