Skip to content

[shell] Add option to spawn command in process group #1332

Closed

Description

@FabianLars

this is basically the fix to issues like pyinstaller apps not being killed because pyinstaller wraps the actual app in a thin parent process that doesn't clean up after itself.

v1's command code was a bit too much for me to find motivation tbh but in this plugin it should be fairly straight forward.

Since may be use cases where this is not desirable, it will be a simple boolean option.

The implementation should use https://github.com/watchexec/process-wrap, the successor of command-group.

p.s. just opening this issue so i don't forget about it until next week, not asking the team to work on this (however, if a community member wants to work on this then i'd be quite happy about it)

Activity

  1. mitulagr2 commented on Jul 13, 2025

    @mitulagr2

    Hi, is this in progress?

  2. FabianLars commented on Jul 13, 2025

    @FabianLars
    MemberAuthor

    No. I started it a few weeks/months ago but it was more annoying to implement than expected. Not even sure if I still have the local branch, gonna check on Monday.

    If you're asking cause you want to pick it up then go for it :)

  3. elibroftw commented on Oct 26, 2025

    @elibroftw

    Is there any API stub? I don't need this feature anymore since I came up with my own solution to the problem but if I ever get the time I'd be happy to help since it makes my code redundant.

    Like just add an option to spawn in a group basically?

  4. FabianLars commented on Oct 26, 2025

    @FabianLars
    MemberAuthor

    Like just add an option to spawn in a group basically?

    That was the idea, yeah. Perhaps not realistic though. I think I lost the very-wip branch I worked on a few months ago though, will check later.

  5. Noremac11800 commented on Jan 21, 2026

    @Noremac11800

    @FabianLars any news on this? This is issue is the last piece of the puzzle I need to get my app up and running. I have an idea of how I'm going to get around it, but it requires significantly more Rust code than I was hoping I would need to write. Ideally, child processes would have a kill_all() option instead of just kill() which would recursively terminate child processes produced by my original parent.

    I don't have the ability to make the parent process cleanup its children and their children because the grandchild processes are 3rd party. My best attempt so far, without writing a more robust solution, is to target killing PIDs by process name, but that approach is fragile and hacky.

  6. added 2 commits that reference this issue on Mar 19, 2026
    9d0d9ef
    883b045
  7. added 2 commits that reference this issue on Jul 25, 2026
    b3e8a4c
    c620414
  8. aka-danielZhang commented on Aug 18, 2026

    @aka-danielZhang

    Field report from a Tauri 2 app that currently rolls its own sidecar supervision: our Rust shell spawns a long-lived Node sidecar directly (not via the shell plugin), and we just moved it to process_group(0) + kill(-pgid, SIGTERM) with a grace-then-SIGKILL ladder on macOS. That plus a pid registry eliminated the orphan accumulation we were seeing (9 orphaned sidecars after a single tauri dev session before; 0 after) — about 30 lines of std + libc, no tree walking, no TOCTOU races between "enumerate children" and "kill them".

    A process-group option in the shell plugin via process-wrap would let apps like ours drop the hand-rolled ladder entirely. Happy to test a draft on macOS against a real long-lived sidecar workload (our sidecar routinely has live child processes of its own).

    One design note from our experience: process groups cover every descendant that doesn't call setsid itself; sandbox executors that do will still escape, so we keep a small pid + ps lstart registry swept on next boot as the last-resort net. A process-wrap-based option gets Job Objects on Windows, which covers that hole natively there.

  9. added a commit that references this issue on Oct 9, 2026
    a8acd17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions