fix: prevent agent hang when backgrounding processes via terminal tool

bash -lic with a PTY enables job control (set -m), which waits for all
background jobs before the shell exits. A command like
`python3 -m http.server &>/dev/null &` hangs forever because the shell
never completes.

Prefix `set +m;` to disable job control while keeping -i for .bashrc
sourcing and PTY for interactive tools.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
handsdiff 2026-04-14 19:43:21 -04:00 committed by Teknium
parent 33ff29dfae
commit 933fbd8fea

View file

@ -334,7 +334,7 @@ class ProcessRegistry:
pty_env = _sanitize_subprocess_env(os.environ, env_vars)
pty_env["PYTHONUNBUFFERED"] = "1"
pty_proc = _PtyProcessCls.spawn(
[user_shell, "-lic", command],
[user_shell, "-lic", f"set +m; {command}"],
cwd=session.cwd,
env=pty_env,
dimensions=(30, 120),
@ -375,7 +375,7 @@ class ProcessRegistry:
bg_env = _sanitize_subprocess_env(os.environ, env_vars)
bg_env["PYTHONUNBUFFERED"] = "1"
proc = subprocess.Popen(
[user_shell, "-lic", command],
[user_shell, "-lic", f"set +m; {command}"],
text=True,
cwd=session.cwd,
env=bg_env,