Skip to content

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

Suppress stdout/stderr in pre-merge hook signal test

Maximilian Roos734242e0af4f
diff --git a/tests/integration_tests/user_hooks.rs b/tests/integration_tests/user_hooks.rs
index cff64e2a9..30d69d4bd 100644
--- a/tests/integration_tests/user_hooks.rs
+++ b/tests/integration_tests/user_hooks.rs
@@ -11,7 +11,7 @@ use crate::common::{
};
use insta_cmd::assert_cmd_snapshot;
use std::fs;
-use std::process::Command;
+use std::process::{Command, Stdio};
use std::thread;
use std::time::Duration;
@@ -421,9 +421,12 @@ long = "sh -c 'echo start >> hook.log; sleep 30; echo done >> hook.log'"
repo.commit("Add pre-merge hook");
// Spawn wt hook pre-merge (skip approval with --force)
+ // Redirect stdout/stderr to null to prevent output leaking into test runner
let mut cmd = crate::common::wt_command();
cmd.current_dir(repo.root_path());
cmd.args(["hook", "pre-merge", "--force"]);
+ cmd.stdout(Stdio::null());
+ cmd.stderr(Stdio::null());
let mut child = cmd.spawn().expect("failed to spawn wt hook pre-merge");
// Wait until hook writes "start" to hook.log (verifies the hook is running)