From 4402a5b0ed46d44c4de81430f6b3dca16b268fe1 Mon Sep 17 00:00:00 2001 From: jleechan Date: Wed, 4 Mar 2026 22:03:05 -0800 Subject: [PATCH] Fix bash job spam: use disown instead of set +m set +m only suppresses notifications for jobs started after it runs. Jobs that complete between prompts still trigger Done output. Using disown removes jobs from bash job table entirely so bash never prints completion notifications for them. Co-Authored-By: Claude Opus 4.6 --- .../shell-integration/cmux-bash-integration.bash | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Resources/shell-integration/cmux-bash-integration.bash b/Resources/shell-integration/cmux-bash-integration.bash index 4576212c..1cfd1919 100644 --- a/Resources/shell-integration/cmux-bash-integration.bash +++ b/Resources/shell-integration/cmux-bash-integration.bash @@ -62,7 +62,7 @@ _cmux_report_tty_once() { _CMUX_TTY_REPORTED=1 { _cmux_send "report_tty $_CMUX_TTY_NAME --tab=$CMUX_TAB_ID --panel=$CMUX_PANEL_ID" - } >/dev/null 2>&1 & + } >/dev/null 2>&1 & disown } _cmux_ports_kick() { @@ -74,7 +74,7 @@ _cmux_ports_kick() { _CMUX_PORTS_LAST_RUN=$SECONDS { _cmux_send "ports_kick --tab=$CMUX_TAB_ID --panel=$CMUX_PANEL_ID" - } >/dev/null 2>&1 & + } >/dev/null 2>&1 & disown } _cmux_prompt_command() { @@ -82,11 +82,6 @@ _cmux_prompt_command() { [[ -n "$CMUX_TAB_ID" ]] || return 0 [[ -n "$CMUX_PANEL_ID" ]] || return 0 - # Suppress bash job-done notifications for background tasks spawned below. - # Without this, every completed async probe prints "[N] Done ..." to the terminal. - local _cmux_old_monitor="${-//[^m]/}" - set +m - local now=$SECONDS local pwd="$PWD" @@ -128,7 +123,7 @@ _cmux_prompt_command() { { local qpwd="${pwd//\"/\\\"}" _cmux_send "report_pwd \"${qpwd}\" --tab=$CMUX_TAB_ID --panel=$CMUX_PANEL_ID" - } >/dev/null 2>&1 & + } >/dev/null 2>&1 & disown fi # Git branch/dirty can change without a directory change (e.g. `git checkout`), @@ -159,6 +154,7 @@ _cmux_prompt_command() { fi } >/dev/null 2>&1 & _CMUX_GIT_JOB_PID=$! + disown _CMUX_GIT_JOB_STARTED_AT=$now fi @@ -202,6 +198,7 @@ _cmux_prompt_command() { fi } >/dev/null 2>&1 & _CMUX_PR_JOB_PID=$! + disown _CMUX_PR_JOB_STARTED_AT=$now fi fi @@ -211,8 +208,6 @@ _cmux_prompt_command() { _cmux_ports_kick fi - # Restore job control if it was previously enabled. - [[ -n "$_cmux_old_monitor" ]] && set -m } _cmux_install_prompt_command() {