Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

fix: replace std::process::exit() with error returns in Windows paths (#1456)

Maximilian Roos8a63a056786f
diff --git a/src/main.rs b/src/main.rs
index cb3258f2b..eda339850 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -467,9 +467,10 @@ fn handle_select_command(branches: bool, remotes: bool) -> anyhow::Result<()> {
#[cfg(not(unix))]
fn handle_select_command(_branches: bool, _remotes: bool) -> anyhow::Result<()> {
+ use worktrunk::git::WorktrunkError;
warn_select_deprecated();
print_windows_picker_unavailable();
- std::process::exit(1);
+ Err(WorktrunkError::AlreadyDisplayed { exit_code: 1 }.into())
}
struct SwitchCommandArgs {
@@ -499,11 +500,12 @@ fn handle_switch_command(spec: SwitchCommandArgs) -> anyhow::Result<()> {
#[cfg(not(unix))]
{
+ use worktrunk::git::WorktrunkError;
// Suppress unused variable warnings on Windows
let _ = (spec.branches, spec.remotes);
print_windows_picker_unavailable();
- std::process::exit(2);
+ return Err(WorktrunkError::AlreadyDisplayed { exit_code: 2 }.into());
}
};