Skip to contentSkip to conversation

standalone: Log things we are running via with_logging

PATCH In review Ian Campbell 2 participants 2 messages Dec 4, 2015 – Dec 8, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 standalone: Log things we are running via with_logging

Turning on set -x generally in this script is too verbose, so run the command in a subshell which sets -x.

---
v2: Use set -x in a sub shell

---
 standalone | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
standalone +1 -1
index c804b74..499cb6c 100755
@@ -195,7 +195,7 @@ with_logging() {
     if command -v savelog >/dev/null ; then
         savelog -c 300 -n "$log" >/dev/null
     fi
-    "$@" 2>&1 | tee "$log"
+    ( set -x ; "$@" ) 2>&1 | tee "$log"
     rc=${PIPESTATUS[0]}
     if [ $rc -ne 0 ] ; then
 	echo "FAILED rc=${rc}" >&2
Signature · 1 line
2.6.1