From d08a962910689e30af664f5d610d8085212601cf Mon Sep 17 00:00:00 2001 From: Nicolas Filotto Date: Thu, 5 Oct 2023 10:12:36 +0200 Subject: [PATCH] fix: handle debug output messing up jbangdev --- src/main/scripts/jbang | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/scripts/jbang b/src/main/scripts/jbang index 48350dcd5..c9c81d797 100755 --- a/src/main/scripts/jbang +++ b/src/main/scripts/jbang @@ -221,6 +221,11 @@ export JBANG_STDIN_NOTTY=$([ -t 0 ] && echo "false" || echo "true") output=$(CLICOLOR_FORCE=1 "${JAVA_EXEC}" ${JBANG_JAVA_OPTIONS} -classpath "${jarPath}" dev.jbang.Main "$@") err=$? if [ $err -eq 255 ]; then + nl=$'\n' + if [[ $output =~ $nl ]]; then + ## keep the last output line to avoid being polluted by the potential verbosity of the JVM + output=$(echo "$output" | tail -1) + fi eval "exec $output" elif [ -n "$output" ]; then echo "$output"