COUCHDB-1339 - stop couchdb on js cli exits

Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/2921c786
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/2921c786
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/2921c786

Branch: refs/heads/COUCHDB-1342
Commit: 2921c7869411f338da036f893f5937178d1e823c
Parents: 8f0b4e6
Author: Randall Leeds <rand...@apache.org>
Authored: Wed Nov 30 22:40:41 2011 -0800
Committer: Randall Leeds <rand...@apache.org>
Committed: Sat Jan 7 13:56:24 2012 -0800

----------------------------------------------------------------------
 test/javascript/run.tpl |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/2921c786/test/javascript/run.tpl
----------------------------------------------------------------------
diff --git a/test/javascript/run.tpl b/test/javascript/run.tpl
index 593f9ed..caffe49 100644
--- a/test/javascript/run.tpl
+++ b/test/javascript/run.tpl
@@ -36,10 +36,19 @@ else
 fi
 
 make dev
+
+# stop CouchDB on exit from various signals
+abort() {
+       trap - 0
+       ./utils/run -d
+       exit 2
+}
+
 # start CouchDB
 if [ -z $COUCHDB_NO_START ]; then
-  ./utils/run -b -r 1
-  sleep 1 # give it a sec
+       trap 'abort' 0 1 2 3 4 6 8 15
+       ./utils/run -b -r 1
+       sleep 1 # give it a sec
 fi
 
 cat $SCRIPT_DIR/json2.js \
@@ -56,4 +65,5 @@ cat $SCRIPT_DIR/json2.js \
 if [ -z $COUCHDB_NO_START ]; then
        # stop CouchDB
        ./utils/run -d
+       trap - 0
 fi

Reply via email to