diff --git a/src/exec.cpp b/src/exec.cpp index 73bab322b..15d8f2660 100644 --- a/src/exec.cpp +++ b/src/exec.cpp @@ -576,6 +576,12 @@ void exec_job(parser_t &parser, job_t *j) { } } + // When running under WSL, create a keepalive process unconditionally if our first process is external. + // This is because WSL does not permit joining the pgrp of an exited process. + // (see https://github.com/Microsoft/WSL/issues/2786), also fish PR #4676 + if (j->processes.front()->type == EXTERNAL && is_windows_subsystem_for_linux()) + needs_keepalive = true; + if (needs_keepalive) { // Call fork. No need to wait for threads since our use is confined and simple. keepalive.pid = execute_fork(false);