From 2830ef4854665eb227bef4dd0c16bc641ce26619 Mon Sep 17 00:00:00 2001 From: Ben Nemec Date: Fri, 28 Mar 2014 22:38:45 -0500 Subject: [PATCH] Check for set -o pipefail Like the other set lint checks, this will hopefully catch errors in element scripts sooner. Change-Id: Ib1600938f6ffed657ff2950ef54bbcbdb5a0db08 --- bin/dib-lint | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/dib-lint b/bin/dib-lint index 9cee120f..2b737abc 100755 --- a/bin/dib-lint +++ b/bin/dib-lint @@ -72,7 +72,7 @@ for i in $(find elements -type f); do fi fi - # Check that all scripts are set -eu + # Check that all scripts are set -eu -o pipefail # NOTE(bnemec): This doesn't verify that the set call occurs high # enough in the file to be useful, but hopefully nobody will be # sticking set calls at the end of their file to trick us. And if @@ -94,6 +94,12 @@ for i in $(find elements -type f); do rc=1 fi fi + if ! excluded setpipefail; then + if [ -z "$(grep "^set -o pipefail" $i)" ]; then + echo "ERROR: $i is not set -o pipefail" + rc=1 + fi + fi fi done