You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2018/05/08 16:11:55 UTC

[3/5] impala git commit: test-with-docker: exit properly on failures

test-with-docker: exit properly on failures

If the build was failing, test-with-docker wouldn't recognize
it and continue with the script; this fixes that.

The bash puzzle I learned here is that

  bash -c "set -e; function f() { false; echo f; }; if f; then echo x; fi"

will print "f" and "x", despite the set -e, even if f is put into
a sub-shell with parentheses.

Change-Id: I285e2f4d07e34898d73beba857e9ac325ed4e6db
Reviewed-on: http://gerrit.cloudera.org:8080/10318
Tested-by: Philip Zeyliger <ph...@cloudera.com>
Reviewed-by: Joe McDonnell <jo...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/6757aca2
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/6757aca2
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/6757aca2

Branch: refs/heads/2.x
Commit: 6757aca2e4f7c0973bb62219d8dad3d0072edd78
Parents: f55479e
Author: Philip Zeyliger <ph...@cloudera.com>
Authored: Fri May 4 15:24:02 2018 -0700
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Tue May 8 03:10:16 2018 +0000

----------------------------------------------------------------------
 docker/entrypoint.sh | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/impala/blob/6757aca2/docker/entrypoint.sh
----------------------------------------------------------------------
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index 00b2ee6..d57cb5e 100755
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -378,11 +378,10 @@ function main() {
   # Dump environment, for debugging
   env | grep -vE "AWS_(SECRET_)?ACCESS_KEY"
   set -x
-  if "${CMD}" "$@"; then
-    ret=0
-  else
-    ret=$?
-  fi
+  # The "| cat" here avoids "set -e"/errexit from exiting the
+  # script right away.
+  "${CMD}" "$@" | cat
+  ret=${PIPESTATUS[0]}
   set +x
   echo ">>> ${CMD} $@ ($ret) (end)"
   exit $ret