diff --git a/install.ps1 b/install.ps1 index 100a3177ba..0b32d7cb6c 100644 --- a/install.ps1 +++ b/install.ps1 @@ -91,6 +91,7 @@ function Install-UnslothStudio { if ($TauriMode) { exit $Code } + throw $Message } # ── Parse flags ── diff --git a/tests/test_installer_skip_autostart.py b/tests/test_installer_skip_autostart.py index 8c283f4458..fcc199af44 100644 --- a/tests/test_installer_skip_autostart.py +++ b/tests/test_installer_skip_autostart.py @@ -1,4 +1,4 @@ -"""Regression tests for the installers' post-install autostart opt-out.""" +"""Regression tests for installer controls and process exits.""" from __future__ import annotations @@ -120,6 +120,27 @@ def test_windows_skip_autostart_bypasses_only_the_interactive_prompt(): ) +@pytest.mark.skipif(shutil.which("pwsh") is None, reason = "PowerShell is unavailable") +def test_windows_installer_invalid_package_fails(): + result = subprocess.run( + [ + "pwsh", + "-NoProfile", + "-NonInteractive", + "-File", + str(INSTALL_PS1), + "--package", + "bad!", + ], + capture_output = True, + text = True, + timeout = 30, + ) + + assert result.returncode != 0 + assert "package name contains invalid characters" in result.stdout + result.stderr + + def test_skip_autostart_is_documented_for_all_installers(): readme = README.read_text(encoding = "utf-8") assert "UNSLOTH_SKIP_AUTOSTART=1 sh" in readme