Make UNSLOTH_STUDIO_NO_BROWSER falsy check case-insensitive in the shell launcher

Simulation testing caught that False or Off disabled the browser in
launch-studio.sh while the PowerShell launcher's -notin treats them as
falsy case-insensitively. Lowercase the value before matching so both
launchers agree, and pin the behavior in the launcher test.
This commit is contained in:
Unsloth 2026-07-08 22:46:10 -07:00
commit 52acbcc250
2 changed files with 8 additions and 2 deletions

View file

@ -656,8 +656,9 @@ fi
# UNSLOTH_STUDIO_NO_BROWSER env var, then studio.conf, default on.
# When off the server still starts; the URL is printed instead (PWA use).
OPEN_BROWSER="${STUDIO_OPEN_BROWSER:-1}"
case "${UNSLOTH_STUDIO_NO_BROWSER:-}" in
''|0|false|FALSE|no|NO|off|OFF) ;;
# Case-insensitive falsy check, matching the PowerShell launcher's -notin.
case "$(printf '%s' "${UNSLOTH_STUDIO_NO_BROWSER:-}" | tr '[:upper:]' '[:lower:]')" in
''|0|false|no|off) ;;
*) OPEN_BROWSER=0 ;;
esac
for _arg in "$@"; do

View file

@ -50,6 +50,11 @@ assert_contains \
assert_contains \
"launcher template: UNSLOTH_STUDIO_NO_BROWSER env var handled" \
"$_launcher" "UNSLOTH_STUDIO_NO_BROWSER"
# Mixed-case falsy values (False, Off) must not disable, matching the
# PowerShell launcher's case-insensitive -notin.
assert_contains \
"launcher template: env var check is case-insensitive" \
"$_launcher" "tr '[:upper:]' '[:lower:]'"
assert_contains \
"launcher template: studio.conf preference is the default" \
"$_launcher" 'OPEN_BROWSER="${STUDIO_OPEN_BROWSER:-1}"'