From 7d429c6724dbb4a0c8be3c43910f5e9d98e224b7 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sat, 27 Nov 2021 20:17:26 -0500 Subject: [PATCH] --no-server mode Fixes #6530 Ref #6101 Problem ------- Although having sbt server up by default is beneficial to well-tested platforms like macOS, on less tested setups various native and/or native-adjacent techniques we use could end up causing instability. Solution -------- This adds `--no-server` as a quick way of telling sbt not to start up the sbt server or create virtual terminal. --- launcher-package/src/universal/bin/sbt.bat | 14 ++++++++++++++ sbt | 2 ++ 2 files changed, 16 insertions(+) diff --git a/launcher-package/src/universal/bin/sbt.bat b/launcher-package/src/universal/bin/sbt.bat index fb325c19a..f44af2219 100755 --- a/launcher-package/src/universal/bin/sbt.bat +++ b/launcher-package/src/universal/bin/sbt.bat @@ -50,6 +50,7 @@ set sbt_args_sbt_dir= set sbt_args_sbt_version= set sbt_args_mem= set sbt_args_client= +set sbt_args_no_server= rem users can set SBT_OPTS via .sbtopts if exist .sbtopts for /F %%A in (.sbtopts) do ( @@ -205,6 +206,15 @@ if defined _no_colors_arg ( goto args_loop ) +if "%~0" == "-no-server" set _no_server_arg=true +if "%~0" == "--no-server" set _no_server_arg=true + +if defined _no_server_arg ( + set _no_server_arg= + set sbt_args_no_server=1 + goto args_loop +) + if "%~0" == "-no-global" set _no_global_arg=true if "%~0" == "--no-global" set _no_global_arg=true @@ -646,6 +656,10 @@ if defined sbt_args_traces ( set _SBT_OPTS=-Dsbt.traces=true !_SBT_OPTS! ) +if defined sbt_args_no_server ( + set _SBT_OPTS=-Dsbt.io.virtual=false -Dsbt.server.autostart=false !_SBT_OPTS! +) + rem TODO: _SBT_OPTS needs to be processed as args and diffed against SBT_ARGS if !sbt_args_print_sbt_version! equ 1 ( diff --git a/sbt b/sbt index c14c2ec32..39b1dac32 100755 --- a/sbt +++ b/sbt @@ -22,6 +22,7 @@ declare sbt_verbose= declare sbt_debug= declare build_props_sbt_version= declare use_sbtn= +declare no_server= declare sbtn_command="$SBTN_CMD" declare sbtn_version="1.4.7" @@ -631,6 +632,7 @@ map_args () { -traces|--traces) options=( "${options[@]}" "-Dsbt.traces=true" ) && shift ;; --supershell=*) options=( "${options[@]}" "-Dsbt.supershell=${1:13}" ) && shift ;; -supershell=*) options=( "${options[@]}" "-Dsbt.supershell=${1:12}" ) && shift ;; + -no-server|--no-server) options=( "${options[@]}" "-Dsbt.io.virtual=false" "-Dsbt.server.autostart=false" ) && shift ;; --color=*) options=( "${options[@]}" "-Dsbt.color=${1:8}" ) && shift ;; -color=*) options=( "${options[@]}" "-Dsbt.color=${1:7}" ) && shift ;; -no-share|--no-share) options=( "${options[@]}" "${noshare_opts[@]}" ) && shift ;;