Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
feat: Enhance Worktrunk CLI, shell integration, and documentation
Maximilian Roos21fb941cb1c6
diff --git a/Cargo.lock b/Cargo.lockindex 1b6b4fcb6..5dc485e1c 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -2586,7 +2586,7 @@ checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"[[package]]name = "worktrunk"-version = "0.1.4"+version = "0.1.5"dependencies = ["anstream","anstyle",diff --git a/Cargo.toml b/Cargo.tomlindex 5212aef15..4492c75de 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -1,6 +1,6 @@[package]name = "worktrunk"-version = "0.1.4"+version = "0.1.5"edition = "2024"build = "build.rs"repository = "https://github.com/max-sixty/worktrunk"@@ -33,6 +33,7 @@ path = "src/main.rs"# This binary uses setsid() to detach child processes from controlling terminals,# preventing PTY-related hangs in nextest. Built with `cargo build` but not installed# by `cargo install` (binaries in subdirectories are excluded from installation).+# Uses conditional compilation: real implementation on Unix, stub on Windows.[[bin]]name = "dev-detach"path = "tests/bin/dev-detach.rs"diff --git a/tests/bin/dev-detach.rs b/tests/bin/dev-detach.rsindex 5e8a8d377..3017a38c4 100644--- a/tests/bin/dev-detach.rs+++ b/tests/bin/dev-detach.rs@@ -8,36 +8,51 @@//!//! The binary becomes a new session leader with no controlling terminal, then replaces//! itself with the target command via execvp().+//!+//! Note: This binary is Unix-only. On Windows, it builds as a stub that exits with an error.+#[cfg(unix)]use nix::unistd::{execvp, setsid};-use std::{env, ffi::CString, process};+#[cfg(unix)]+use std::ffi::CString;+use std::{env, process};fn main() {- // Become a new session leader with no controlling terminal.- // This is the key to preventing PTY-related hangs - the child process- // starts life completely detached from any terminal.- if let Err(e) = setsid() {- eprintln!("dev-detach: setsid failed: {}", e);- process::exit(1);- }+ #[cfg(unix)]+ {+ // Become a new session leader with no controlling terminal.+ // This is the key to preventing PTY-related hangs - the child process+ // starts life completely detached from any terminal.+ if let Err(e) = setsid() {+ eprintln!("dev-detach: setsid failed: {}", e);+ process::exit(1);+ }- // Get command and arguments from our argv- let args: Vec<String> = env::args().skip(1).collect();- if args.is_empty() {- eprintln!("usage: dev-detach <command> [args...]");- process::exit(2);- }+ // Get command and arguments from our argv+ let args: Vec<String> = env::args().skip(1).collect();+ if args.is_empty() {+ eprintln!("usage: dev-detach <command> [args...]");+ process::exit(2);+ }- // Convert to CStrings for execvp- let prog = CString::new(args[0].clone()).unwrap();- let cargs: Vec<CString> = args- .iter()- .map(|a| CString::new(a.as_str()).unwrap())- .collect();+ // Convert to CStrings for execvp+ let prog = CString::new(args[0].clone()).unwrap();+ let cargs: Vec<CString> = args+ .iter()+ .map(|a| CString::new(a.as_str()).unwrap())+ .collect();- // Replace this process with the target command.- // If execvp returns, it failed.- let _ = execvp(&prog, &cargs);- eprintln!("dev-detach: execvp failed");- process::exit(127);+ // Replace this process with the target command.+ // If execvp returns, it failed.+ let _ = execvp(&prog, &cargs);+ eprintln!("dev-detach: execvp failed");+ process::exit(127);+ }++ #[cfg(not(unix))]+ {+ eprintln!("dev-detach is only supported on Unix systems");+ eprintln!("This binary is used for TTY isolation in tests and is not needed on Windows");+ process::exit(1);+ }}