From ee98244425d687026d25608a609451ad056d6093 Mon Sep 17 00:00:00 2001 From: "Mark S. Lewis" Date: Thu, 19 Jul 2018 09:35:23 +0100 Subject: [PATCH] Cleanly stop npm proxy in Playground API devStart.sh (#4259) Signed-off-by: Mark S. Lewis --- .../composer-playground-api/scripts/devStart.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/composer-playground-api/scripts/devStart.sh b/packages/composer-playground-api/scripts/devStart.sh index cdaf9ba72e..3811f989bb 100755 --- a/packages/composer-playground-api/scripts/devStart.sh +++ b/packages/composer-playground-api/scripts/devStart.sh @@ -13,8 +13,8 @@ # limitations under the License. # -# Exit on first error, print all commands -set -ev +# Stop on any errors +set -e # Environment vaiable directs Playground (connector server) to an npmrc to supply to network install export NPMRC_FILE='/tmp/npmrc' @@ -38,8 +38,15 @@ for package in composer-common composer-runtime composer-runtime-hlfv1; do npm publish --userconfig "${scriptDir}/publish.npmrc" "${packagesDir}/${package}" done +Shutdown() { + # Stop the npm proxy + docker-compose -f "${scriptDir}/docker-compose.yaml" down + exit 0 +} + +echo '' +echo '*** Ctrl-C to stop Playground API ***' +trap Shutdown SIGINT + # Start the Playground API npm start - -# Stop the npm proxy -docker-compose -f "${scriptDir}/docker-compose.yaml" down