[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit 9d1e2abc9977d27c6027e628b3908a49c466c1f4
Author: Arturo Filastò <art@xxxxxxxxx>
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



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits