Skip to content

Commit 8d24b1f

Browse files
committed
mega-melt: avoid mvn ANSI color bug
Otherwise, the kotlin.version property comes back as: <ESC>[0m<ESC>[0m1.8.22 rather than the expected: 1.8.22
1 parent a16037e commit 8d24b1f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/run.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,13 @@ sed -E 's; -Dij\.version=([^ ]*);& -Dimagej1.version=\1;' "$buildScriptTemp" > "
145145

146146
# HACK: Add explicit kotlin.version to match our pom-scijava-base.
147147
# Otherwise, components built on older pom-scijava-base will have
148-
# mismatched kotlin component versions.
149-
kotlinVersion=$(mvn -B -U -q -Denforcer.skip=true -Dexec.executable=echo \
150-
-Dexec.args='${kotlin.version}' --non-recursive validate exec:exec 2>&1 | head -n1) &&
148+
# mismatched kotlin component versions. The sed expression avoids
149+
# a bug in mvn's batch mode that results in <ESC>[0m<ESC>[0m still
150+
# appearing as a leading ANSI sequence when echoing the property.
151+
kotlinVersion=$(
152+
mvn -B -U -q -Denforcer.skip=true -Dexec.executable=echo \
153+
-Dexec.args='${kotlin.version}' --non-recursive validate exec:exec 2>&1 |
154+
head -n1 | sed 's;\(.\[[0-9]m\)*;;') &&
151155
mv -f "$buildScript" "$buildScriptTemp" &&
152156
sed -E "s;mvn -Denforcer.skip;& -Dkotlin.version=$kotlinVersion;" "$buildScriptTemp" > "$buildScript" &&
153157

0 commit comments

Comments
 (0)