Skip to content

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

fix(zsh): disable job control messages for background processes

Maximilian Roos0feffd98c55b
diff --git a/templates/posix_directives.sh b/templates/posix_directives.sh
index d625bab03..0a3abf69d 100644
--- a/templates/posix_directives.sh
+++ b/templates/posix_directives.sh
@@ -22,11 +22,14 @@ wt_exec() {
return 1
fi
+ # Run command in background to enable real-time streaming via FIFO.
(
command "${_WORKTRUNK_CMD:-{{ cmd_prefix }}}" "$@"
printf '%s' "$?" >"$exit_file"
) >"$fifo_path" &
runner_pid=$!
+ # Remove job from shell's job table to prevent job control notifications
+ disown "$runner_pid" 2>/dev/null || true
# Read directives as they arrive; keep looping even if the final chunk isn't NUL-terminated.
while IFS= read -r -d '' chunk || [[ -n "$chunk" ]]; do
diff --git a/tests/snapshots/integration__integration_tests__init__init_bash.snap b/tests/snapshots/integration__integration_tests__init__init_bash.snap
index a0d90c94a..906fef54d 100644
--- a/tests/snapshots/integration__integration_tests__init__init_bash.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_bash.snap
@@ -16,7 +16,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpxzUWIj/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp2HZYvq/test-config.toml
---
success: true
exit_code: 0
@@ -53,11 +53,14 @@ wt_exec() {
return 1
fi
+ # Run command in background to enable real-time streaming via FIFO.
(
command "${_WORKTRUNK_CMD:-wt}" "$@"
printf '%s' "$?" >"$exit_file"
) >"$fifo_path" &
runner_pid=$!
+ # Remove job from shell's job table to prevent job control notifications
+ disown "$runner_pid" 2>/dev/null || true
# Read directives as they arrive; keep looping even if the final chunk isn't NUL-terminated.
while IFS= read -r -d '' chunk || [[ -n "$chunk" ]]; do
diff --git a/tests/snapshots/integration__integration_tests__init__init_zsh.snap b/tests/snapshots/integration__integration_tests__init__init_zsh.snap
index 8be669ea1..0f705eb30 100644
--- a/tests/snapshots/integration__integration_tests__init__init_zsh.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_zsh.snap
@@ -16,7 +16,7 @@ info:
LANG: C
LC_ALL: C
SOURCE_DATE_EPOCH: "1761609600"
- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp5Q3l96/test-config.toml
+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp5Cg1aN/test-config.toml
---
success: true
exit_code: 0
@@ -53,11 +53,14 @@ wt_exec() {
return 1
fi
+ # Run command in background to enable real-time streaming via FIFO.
(
command "${_WORKTRUNK_CMD:-wt}" "$@"
printf '%s' "$?" >"$exit_file"
) >"$fifo_path" &
runner_pid=$!
+ # Remove job from shell's job table to prevent job control notifications
+ disown "$runner_pid" 2>/dev/null || true
# Read directives as they arrive; keep looping even if the final chunk isn't NUL-terminated.
while IFS= read -r -d '' chunk || [[ -n "$chunk" ]]; do