diff --git a/scripts/objc-test-ios.sh b/scripts/objc-test-ios.sh index 0332412ad..a85caa073 100755 --- a/scripts/objc-test-ios.sh +++ b/scripts/objc-test-ios.sh @@ -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") &