Skip to content

[Bug]: Spawning and unreferencing a child process prevents electron from exiting #34808

@Josh-G

Description

@Josh-G

Preflight Checklist

Electron Version

19.0.7

What operating system are you using?

Other Linux

Operating System Version

Debian 10 (buster)

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

No response

Expected Behavior

Running the following:

spawn('sleep', ['10'], {
    detached: true,
    stdio: 'ignore',
}).unref();

should allow Electron to exit without waiting for the child process.

Actual Behavior

Electron emits the correct events, however some electron processes linger until the child process has completed.

Testcase Gist URL

https://gist.github.com/Josh-G/aadee165b50c7629d5f1c9340728a8ca

Additional Information

I've also created a repo with a workflow that demonstrates the issue; https://github.com/Josh-G/electron-spawn-detached

I believe this may be the same as, or a regression of, #2208 #13870.
I've reproduced this on Linux on arm64 + x64 with Debian and Ubuntu (thru GitHub Action).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions