Skip to content

Commit 4f3a926

Browse files
authored
(#8717) run-test.sh: always shut down server on exit
1 parent f1a9b89 commit 4f3a926

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

bin/run-test.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
#!/bin/bash -e
22

3+
cleanup() {
4+
if [[ ! -z $SERVER_PID ]]; then
5+
kill $SERVER_PID
6+
fi
7+
}
8+
trap cleanup EXIT
9+
310
# Run tests against a local setup of pouchdb-express-router
411
# by default unless COUCH_HOST is specified.
512
[ -z "$COUCH_HOST" -a -z "$SERVER" ] && SERVER="pouchdb-express-router"
@@ -135,9 +142,3 @@ elif [ "$CLIENT" == "dev" ]; then
135142
else
136143
npm run test-browser
137144
fi
138-
139-
EXIT_STATUS=$?
140-
if [[ ! -z $SERVER_PID ]]; then
141-
kill $SERVER_PID
142-
fi
143-
exit $EXIT_STATUS

0 commit comments

Comments
 (0)