From becd7652b1ee704ddba682f6daccf4db1db11a57 Mon Sep 17 00:00:00 2001 From: Tolga Ceylan Date: Sat, 23 Dec 2017 13:05:41 -0800 Subject: [PATCH] Shell script error handling (#628) * fn: fortify shell scripts with euo pipefail --- go-fmt.sh | 5 ++--- release.sh | 2 +- test.sh | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/go-fmt.sh b/go-fmt.sh index 501af15dc..a16bbae83 100755 --- a/go-fmt.sh +++ b/go-fmt.sh @@ -1,7 +1,6 @@ -#!/bin/sh +#!/bin/bash # find and output all Go files that are not correctly formatted - -set -e +set -euo pipefail # Find all .go files except those under vendor/ or .git, run gofmt -l on them OUT=$(find ! \( -path ./vendor -prune \) ! \( -path ./.git -prune \) -name '*.go' -exec gofmt -l {} +) diff --git a/release.sh b/release.sh index ca1843f91..2153775f9 100755 --- a/release.sh +++ b/release.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -ex +set -exuo pipefail user="fnproject" image="fnserver" diff --git a/test.sh b/test.sh index 6dba85c41..ffdfbddbf 100755 --- a/test.sh +++ b/test.sh @@ -1,7 +1,6 @@ #!/bin/bash # Top level test script to start all other tests - -set -ex +set -exuo pipefail function host { case ${DOCKER_LOCATION:-localhost} in