Permalink
Browse files

Kill all children on failure ;->

  • Loading branch information...
1 parent e14db0c commit d7929a70c852cada4057f6ddf47a46809c7e5de7 @sickill committed Dec 29, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 bin/bitpocket
View
@@ -88,7 +88,7 @@ function sync {
function on_slow_sync_start {
if [ -n "$SLOW_SYNC_START_CMD" ]; then
rm -rf "$SLOW_SYNC_FILE"
- (sleep $SLOW_SYNC_TIME && touch "$SLOW_SYNC_FILE" && eval "$SLOW_SYNC_START_CMD") &
+ (sleep $SLOW_SYNC_TIME && touch "$SLOW_SYNC_FILE" && eval "$SLOW_SYNC_START_CMD" ; wait) &
disown
shell_pid=$!
fi
@@ -134,6 +134,7 @@ function die {
cleanup
if [ -n "$shell_pid" ]; then
+ pkill -P $shell_pid &>/dev/null
kill $shell_pid &>/dev/null
fi

0 comments on commit d7929a7

Please sign in to comment.