From 668670d78216980a241d432f399d814179de51d8 Mon Sep 17 00:00:00 2001
From: Matthew K Defenderfer <mdefende@uab.edu>
Date: Fri, 30 Aug 2024 09:53:03 -0500
Subject: [PATCH] simplify exit on error by setting options at the beginning of
 the script

---
 src/run-mmpol.sh | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/run-mmpol.sh b/src/run-mmpol.sh
index 3bfa26d..7eaed0d 100755
--- a/src/run-mmpol.sh
+++ b/src/run-mmpol.sh
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+set -euxo pipefail
+
 # run an mmapply policy across the cluster via slurm
 
 # gather info to map mmapplypolicy to runtime configuration
@@ -35,14 +37,6 @@ echo $cmd
 # run policy command
 $cmd
 
-rcode=$?
-
-if [ $rcode -ne 0 ]
-then
-  echo error: mmapplypoicy failed: code $rcode
-  exit $rcode
-fi
-
 # tag output file with run metadata
 outfile=`ls -t $tmpglobal | head -1`
 if [[ "$outfile" != "" ]]
-- 
GitLab