[tor-commits] [ooni-probe/master] Check return values inside run_or_exit function.

art at torproject.org art at torproject.org
Thu Jun 26 13:58:10 UTC 2014


commit 9d1e2abc9977d27c6027e628b3908a49c466c1f4
Author: Arturo Filastò <art at fuffa.org>
Date:   Sat May 31 18:26:53 2014 +0200

    Check return values inside run_or_exit function.
---
 scripts/install_on_planetlab.sh |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/scripts/install_on_planetlab.sh b/scripts/install_on_planetlab.sh
index 97d64f5..c140940 100644
--- a/scripts/install_on_planetlab.sh
+++ b/scripts/install_on_planetlab.sh
@@ -194,11 +194,16 @@ setup_ooniprobe() {
 }
 
 run_or_exit() {
+  command=$1
   cd $TMP_INSTALL_DIR &&
-  echo "[*] Running" $1 &&
-  $1 &&
-  echo "[*] Completed running" $1 ||
-  (echo "[!] Failed to run" $1 && exit 1)
+  echo "[*] Running" $command
+  $command
+  return_value=$?
+  if [ $return_value -ne 0 ]; then
+    echo "[!] Failed to run" $command
+    exit 1
+  fi
+  echo "[*] Completed running" $command
 }
 
 run_or_exit yum_installs





More information about the tor-commits mailing list