Skip to content

Orphaned jobs remain running under WSL #5263

@mqudsi

Description

@mqudsi

I imagine this is a case of fish relying on some posix behavior that isn't enforced under WSL, but the following results in backgrounded "unreachable" processes under fish/WSL:

~> nvim &
~> exit

Which is not the case under other platforms (just tested under macOS). Under WSL, the processes are dissociated from fish, as if disown or nohup were used.

As I develop fish primarily under WSL, in 1b1bc28 I added an explicit kill_background_jobs() function to emulate fish's behavior on exit for exec; I imagine this should simply be called on exit under WSL?

Unless the right thing here is for fish not get involved and let the OS do its thing? Then again, job control is purely in the domain of the shell, so inconsistent behavior across platforms in that department is fish's job, right?

(So WSL used to terminate all background processes, disowned or not, when the last WSL terminal window closed. They made an architectural decision to spawn a new init per terminal window (crazy, I know) which remains alive to support nohupd jobs or services, but in the process init doesn't kill backgrounded jobs whose session has ended, leading to this PR.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions