Skip to content

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

Add shell quoting caveat for pager commands

Maximilian Roos35cdeaafe598
diff --git a/src/commands/select.rs b/src/commands/select.rs
index 6904b1982..4cdf634f6 100644
--- a/src/commands/select.rs
+++ b/src/commands/select.rs
@@ -85,6 +85,9 @@ const PAGER_TIMEOUT: Duration = Duration::from_millis(2000);
/// `--paging=never` to prevent them from spawning less.
/// Returns None if pipeline fails or times out (caller should fall back to raw diff).
fn run_git_diff_with_pager(git_args: &[&str], pager_cmd: &str) -> Option<String> {
+ // Note: pager_cmd is expected to be valid shell code (like git's core.pager).
+ // Users with paths containing special chars must quote them in their config.
+
// Some pagers spawn `less` by default which hangs in non-TTY contexts
let pager_with_args = if pager_needs_paging_disabled(pager_cmd) {
format!("{} --paging=never", pager_cmd)
diff --git a/src/help_pager.rs b/src/help_pager.rs
index ae60e1b58..abc076261 100644
--- a/src/help_pager.rs
+++ b/src/help_pager.rs
@@ -87,6 +87,8 @@ pub fn show_help_in_pager(help_text: &str) -> std::io::Result<()> {
// Always send pager output to stderr (standard for help text, like git)
// This works in all cases: direct invocation, shell wrapper, piping, etc.
+ // Note: pager_cmd is expected to be valid shell code (like git's core.pager).
+ // Users with paths containing special chars must quote them in their config.
let final_cmd = format!("{} >&2", pager_cmd);
// Spawn pager with TTY access (interactive, unlike detached diff renderer)