eca
eca copied to clipboard
shell_command: background processes with & don't detach properly due to process group waiting
Problem
In ECA's shell_command, backgrounding with & isn't sufficient because the runner often waits on the entire process group, not just the shell. Even though the shell returns, the tool keeps waiting as long as bb nrepl (or other background processes) are still attached to the same process group.
Additionally, disown usually does nothing in non-interactive shells, so it won't properly detach the job.
Current Behavior
- Commands ending with
&are backgrounded in the shell - The tool runner waits for the entire process group
- Background processes like
bb nreplkeep the tool running indefinitely disownhas no effect in non-interactive shells
Expected Behavior
- Backgrounded processes should detach from the process group
- The tool should return immediately when the shell command completes
- Long-running background processes shouldn't block tool completion
Impact
- Cannot fire-and-forget long-running processes (e.g., starting servers, REPLs)
- Tool hangs waiting for background jobs to finish
- Poor UX for workflows involving background tasks
Possible Solutions
- Use
setsidornohupto create new session for background processes - Modify runner to only wait for the main shell process, not the entire group
- Document workaround: use
nohup cmd >/dev/null 2>&1 &pattern
Closing as a duplicate of #77, we need to fix that, the critical part is what to do with commands spawned, we canno kill then later