Permalink
Browse files

handle multi-word arguments for heart restart command

  • Loading branch information...
1 parent a1f8536 commit 9194d12bc719d65fb4ef5c27de231f1f0612289c @vinoski vinoski committed May 9, 2010
Showing with 11 additions and 1 deletion.
  1. +11 −1 scripts/yaws.template
View
@@ -136,7 +136,17 @@ if [ "$HEART" = true ]; then
fi
fi
fi
-HEART_COMMAND="$ENV_PGM HEART=true YAWS_HEART_RESTARTS=$restarts YAWS_HEART_START=$starttime $program "${1+"$@"}
+HEART_COMMAND="$ENV_PGM HEART=true YAWS_HEART_RESTARTS=$restarts YAWS_HEART_START=$starttime $program"
+# This loop quotes arguments containing whitespace so they can be passed
+# properly to the next heart restart
+for arg in "$@"; do
+ ws=`( set X $arg ; echo $# )`
+ if [ "$ws" -gt 2 ]; then
+ HEART_COMMAND="$HEART_COMMAND '$arg'"
+ else
+ HEART_COMMAND="$HEART_COMMAND $arg"
+ fi
+done
export HEART_COMMAND
while [ $# -gt 0 ]

0 comments on commit 9194d12

Please sign in to comment.