eca icon indicating copy to clipboard operation
eca copied to clipboard

shell_command: background processes with & don't detach properly due to process group waiting

Open davidwuchn opened this issue 10 months ago • 1 comments

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 nrepl keep the tool running indefinitely
  • disown has 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

  1. Use setsid or nohup to create new session for background processes
  2. Modify runner to only wait for the main shell process, not the entire group
  3. Document workaround: use nohup cmd >/dev/null 2>&1 & pattern

davidwuchn avatar Feb 04 '26 13:02 davidwuchn

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

ericdallo avatar Feb 04 '26 18:02 ericdallo