From 2d21c0fd2a67641f63e8e4f4f4b68772ae41fad1 Mon Sep 17 00:00:00 2001 From: Eric Peters Date: Mon, 4 Feb 2019 20:38:10 -0800 Subject: [PATCH] Simplify the debug in execRunner and fix the $java_args[@] expansion, fixes #253 --- src/universal/bin/sbt-launch-lib.bash | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/universal/bin/sbt-launch-lib.bash b/src/universal/bin/sbt-launch-lib.bash index f272947d3..ce022f7db 100755 --- a/src/universal/bin/sbt-launch-lib.bash +++ b/src/universal/bin/sbt-launch-lib.bash @@ -57,14 +57,10 @@ rt_export_file () { } execRunner () { - # print the arguments one to a line, quoting any containing spaces + # print the arguments one to a line, shell-quoted [[ $verbose || $debug ]] && echo "# Executing command line:" && { - for arg; do - if printf "%s\n" "$arg" | grep -q ' '; then - printf "\"%s\"\n" "$arg" - else - printf "%s\n" "$arg" - fi + for arg in "$@"; do + printf "%q\n" "$arg" done echo "" } @@ -348,7 +344,7 @@ run() { $(get_gc_opts) \ ${JAVA_OPTS} \ ${SBT_OPTS:-$default_sbt_opts} \ - ${java_args[@]} \ + "${java_args[@]}" \ -jar "$sbt_jar" \ "${sbt_commands[@]}" \ "${residual_args[@]}"