From ff4825ccffa237a575ab3c9d7afe59b245b4d4e0 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 16 Mar 2025 22:33:53 -0400 Subject: [PATCH] fix: Fix sbt --client on Windows **Problem** sbt --client doens't work on Windows because the runner script passes itself to the server, but it's unable to launch Bash script. **Solution** Pass in the bat version instead on Windows. --- .github/workflows/ci.yml | 6 +++++- sbt | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dbc83f1d7..88c47b39e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -161,7 +161,8 @@ jobs: # test building sbtn on Linux sbt "-Dsbt.io.virtual=false" nativeImage # smoke test native Image - ./client/target/bin/sbtn shutdown + ./client/target/bin/sbtn --sbt-script=$(pwd)/sbt about + ./client/target/bin/sbtn --sbt-script=$(pwd)/sbt shutdown # test launcher script echo build using JDK 8 test using JDK 8 and JDK 11 cd launcher-package @@ -189,6 +190,9 @@ jobs: run: | # test building sbtn on Windows sbt "-Dsbt.io.virtual=false" nativeImage + # smoke test native Image + ./client/target/bin/sbtn --sbt-script=$(pwd)/launcher-package/src/universal/bin/sbt.bat about + ./client/target/bin/sbtn --sbt-script=$(pwd)/launcher-package/src/universal/bin/sbt.bat shutdown # test launcher script echo build using JDK 8, test using JDK 8, on Windows cd launcher-package diff --git a/sbt b/sbt index 6427f287d..5eff91e6d 100755 --- a/sbt +++ b/sbt @@ -805,7 +805,12 @@ runNativeClient() { unset 'original_args[i]' fi done - sbt_script=$0 + + if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then + sbt_script="$0.bat" + else + sbt_script="$0" + fi sbt_script=${sbt_script/ /%20} execRunner "$sbtn_command" "--sbt-script=$sbt_script" "${original_args[@]}" }