UIExplorer e2e: fix duplicated exit trap

Summary: I accidentally introduced an exit trap, allthough a cleanup handler already existed. This moves killing of background processes into the existing trap.

Reviewed By: bestander

Differential Revision: D4681289

fbshipit-source-id: f8bcdcac7b246854e3ee024c9335b6c4eb3aacbd
This commit is contained in:
David Aurelio 2017-03-09 03:09:21 -08:00 committed by Facebook Github Bot
parent 8d6776c143
commit 21c229119d

View File

@ -1,8 +1,6 @@
#!/bin/bash
set -ex
trap 'kill $(jobs -p)' INT TERM EXIT
SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
ROOT=$(dirname "$SCRIPTS")
@ -18,12 +16,15 @@ function cleanup {
WATCHMAN_LOGS=/usr/local/Cellar/watchman/3.1/var/run/watchman/$USER.log
[ -f "$WATCHMAN_LOGS" ] && cat "$WATCHMAN_LOGS"
fi
# kill backgrounded jobs
# shellcheck disable=SC2046
kill $(jobs -p)
# kill whatever is occupying port 8081 (packager)
lsof -i tcp:8081 | awk 'NR!=1 {print $2}' | xargs kill
# kill whatever is occupying port 5555 (web socket server)
lsof -i tcp:5555 | awk 'NR!=1 {print $2}' | xargs kill
}
trap cleanup EXIT
trap cleanup INT TERM EXIT
# Start the packager
(exec "./packager/launchPackager.command" || echo "Can't start packager automatically") &