Skip to content

Commit e1a8fb3

Browse files
committed
updated script to stop when java program ends with error
1 parent e700cb8 commit e1a8fb3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

run.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,19 @@ for file in lib/*; do
4545
CLASSPATH=$CLASSPATH:$PWD/$file:
4646
done
4747

48-
TIMEFORMAT="Run $REPS repetitions of the program with success in %R seconds"
48+
SUCCESS_REPS=0
4949

50+
TIMEFORMAT="The script run for %3R seconds"
5051
time {
5152
for i in $(seq 1 $REPS); do
5253
echo "Iteration $i of the program"
5354
java -cp $CLASSPATH main.Assault $LOGGING
55+
if [ $? -ne 0 ]; then
56+
echo "Error running the program"
57+
break
58+
fi
59+
SUCCESS_REPS=$((SUCCESS_REPS+1))
5460
done
5561
}
62+
63+
echo "Run $SUCCESS_REPS repetitions of the program with success"

0 commit comments

Comments
 (0)