From d78bc45be176e7468d0055f005f7355e05763e73 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Mon, 13 Feb 2017 11:53:40 +0100 Subject: [PATCH] Properly fail in travis if sub-script fail. Make `kiwix-build.py` also fail if sub-command fail instead of just print an error message and quit. `kiwix-deploy.py` is far more simple and already fails miserably if a sub-command fails. --- kiwix-build.py | 4 ++-- travis/compile_all.sh | 2 ++ travis/deploy.sh | 2 ++ travis/install_extra_deps.sh | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/kiwix-build.py b/kiwix-build.py index 6523e8d..91309fc 100755 --- a/kiwix-build.py +++ b/kiwix-build.py @@ -245,7 +245,7 @@ class BuildEnv: 'It should probably not work, but well, you still can have a try.') cont = input('Do you want to continue ? [y/N]') if cont.lower() != 'y': - sys.exit(0, 'Exiting...') + sys.exit(0) if _platform == 'Darwin': print('WARNING: kiwix-build has not been tested on MacOS platfrom.\n' 'Tests, bug reports and patches are welcomed.') @@ -1011,7 +1011,7 @@ class Builder: print("[BUILD]") self.build() except StopBuild: - print("Stopping build due to errors") + sys.exit("Stopping build due to errors") def parse_args(): parser = argparse.ArgumentParser() diff --git a/travis/compile_all.sh b/travis/compile_all.sh index 700809d..7358c69 100755 --- a/travis/compile_all.sh +++ b/travis/compile_all.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -e + OPTION="" if [ "${STATIC_BUILD}" = "true" ]; then OPTION="--build-static" diff --git a/travis/deploy.sh b/travis/deploy.sh index 703372e..997637f 100755 --- a/travis/deploy.sh +++ b/travis/deploy.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -e + SSH_KEY=travis/travisci_builder_id_key chmod 600 ${SSH_KEY} diff --git a/travis/install_extra_deps.sh b/travis/install_extra_deps.sh index f3578cd..6f2540d 100755 --- a/travis/install_extra_deps.sh +++ b/travis/install_extra_deps.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +set -e + orig_dir=$(pwd) sudo apt-get update -qq