Browse Source

add check to see if process is running

because when we interrupt the tests via ^C, the signal also kills the
background process
Francisco Giordano 8 years ago
parent
commit
9a006f3a68
1 changed files with 2 additions and 2 deletions
  1. 2 2
      scripts/test.sh

+ 2 - 2
scripts/test.sh

@@ -4,8 +4,8 @@
 trap cleanup EXIT
 
 cleanup() {
-  # Kill the testrpc instance that we started (if we started one).
-  if [ -n "$testrpc_pid" ]; then
+  # Kill the testrpc instance that we started (if we started one and if it's still running).
+  if [ -n "$testrpc_pid" ] && ps -p $testrpc_pid > /dev/null; then
     kill -9 $testrpc_pid
   fi
 }