Browse code

Skip child process kills in stack.sh exit trap

Logs are still being cut off in certain circumstances, almost certainly
because the awk process handling the output for verbose logging to a file
dies/is killed early.

Don't kill child processes in the EXIT trap function in this specific case.

Change-Id: I89600b61d59f87e93ff959710d0169e49d2c9845

Dean Troyer authored on 2014/03/22 03:00:32
Showing 1 changed files
... ...
@@ -595,7 +595,9 @@ trap exit_trap EXIT
595 595
 function exit_trap {
596 596
     local r=$?
597 597
     jobs=$(jobs -p)
598
-    if [[ -n $jobs ]]; then
598
+    # Only do the kill when we're logging through a process substitution,
599
+    # which currently is only to verbose logfile
600
+    if [[ -n $jobs && -n "$LOGFILE" && "$VERBOSE" == "True" ]]; then
599 601
         echo "exit_trap: cleaning up child processes"
600 602
         kill 2>&1 $jobs
601 603
     fi