Skip to content

Commit 3196faa

Browse files
committed
mega-melt: fix melting-pot fail fast behavior
Even with pipefail, it wasn't propagating the error code, so the mega-melt process was continuing erroneously. The good thing is: without the POSIX-unfriendly pipefail flag, we can go back to /bin/sh now.
1 parent 314d246 commit 3196faa

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

tests/run.sh

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
#
44
# run.sh - Tests correctness of the pom-scijava BOM.
@@ -64,10 +64,6 @@ else
6464
fi ||
6565
die "Failed to obtain melting pot script!"
6666

67-
# Prevent tee from eating the melting-pot error code.
68-
# See: https://stackoverflow.com/a/6872163/1207769
69-
set -o pipefail
70-
7167
# Build the melting pot structure.
7268
chmod +x "$meltingPotScript" &&
7369
"$meltingPotScript" "$megaMeltDir" \
@@ -91,11 +87,13 @@ chmod +x "$meltingPotScript" &&
9187
-e 'org.scijava:jep' \
9288
-e 'org.scijava:junit-benchmarks' \
9389
-e 'org.scijava:vecmath' \
94-
-f -v -s $@ 2>&1 | tee "$meltingPotLog" ||
95-
die 'Melting pot build failed!'
90+
-f -v -s $@ 2>&1 | tee "$meltingPotLog"
9691

97-
# Restore original exit code behavior.
98-
set +o pipefail
92+
# NB: The pipe to tee eats the melting-pot error code.
93+
# Even with the POSIX-unfriendly pipefail flag set.
94+
# So we resort to this hacky error check of the log.
95+
grep -qF "[ERROR]" "$meltingPotLog" &&
96+
die 'Melting pot generation failed!'
9997

10098
# HACK: Remove known-duplicate artifactIds from version property overrides.
10199
# The plan is for this step to become unnecessary once the melting pot has

0 commit comments

Comments
 (0)