Fix exit_trap() error if no child processes

Bug-Id: 1285776
Change-Id: Iad7a9f2c03cc39159beda55345f232cefed10520
diff --git a/stack.sh b/stack.sh
index 4333fb2..f4342dd 100755
--- a/stack.sh
+++ b/stack.sh
@@ -587,8 +587,11 @@
 trap exit_trap EXIT
 function exit_trap {
     local r=$?
-    echo "exit_trap called, cleaning up child processes"
-    kill 2>&1 $(jobs -p)
+    jobs=$(jobs -p)
+    if [[ -n $jobs ]]; then
+        echo "exit_trap: cleaning up child processes"
+        kill 2>&1 $jobs
+    fi
     exit $r
 }