diff --git a/src/common.h b/src/common.h index be21c9fe6..4e3b61ca2 100644 --- a/src/common.h +++ b/src/common.h @@ -962,6 +962,8 @@ void assert_is_not_forked_child(const char *who); /// and checking if "Microsoft" is in the first line. /// See https://github.com/Microsoft/WSL/issues/423 and Microsoft/WSL#2997 constexpr bool is_windows_subsystem_for_linux() { + // This function is called after fork() and before exec() in postfork.cpp. Make sure we + // don't allocate any memory here! #ifdef WSL return true; #else diff --git a/src/postfork.cpp b/src/postfork.cpp index fd4a4f320..ae006cf92 100644 --- a/src/postfork.cpp +++ b/src/postfork.cpp @@ -106,6 +106,11 @@ bool child_set_group(job_t *j, process_t *p) { 1, "Could not send own process %s, '%s' in job %s, '%s' from group %s to group %s", pid_buff, argv0, job_id_buff, command, getpgid_buff, job_pgid_buff); + if (is_windows_subsystem_for_linux() && errno == EPERM) { + debug_safe(1, "Please update to Windows 10 1809/17763 or higher to address known issues " + "with process groups and zombie processes."); + } + safe_perror("setpgid"); return false;