From 1b1fd5ab9b7c7ac1b4152f636c63fc425dc3cf5f Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 24 Dec 2017 16:48:00 -0800 Subject: [PATCH] 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. --- src/exec.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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);