Mark needs_keepalive more often for WSL

Have WSL use a keepalive whenever the first process is external.
This works around the fact that WSL prohibits setting an exited
process as the group leader.
This commit is contained in:
ridiculousfish 2017-12-24 16:48:00 -08:00
parent cef39cdcc0
commit 1b1fd5ab9b

View file

@ -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);