mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-24 09:23:38 +08:00
Don't spawn keepalive for WSL when only one command
This should speed things up on slower PCs given that the vast majority of shell commands are simple jobs consisting of a single command without any pipelines, in which case there's no need for a keepalive process at all. Applies to WSL only.
This commit is contained in:
parent
000892e315
commit
2f2a221c56
14
src/exec.cpp
14
src/exec.cpp
|
@ -577,15 +577,17 @@ void exec_job(parser_t &parser, job_t *j) {
|
|||
needs_keepalive = true;
|
||||
break;
|
||||
}
|
||||
// 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 (is_windows_subsystem_for_linux() && j->processes.front()->type == EXTERNAL
|
||||
&& !p->is_first_in_job) { //but not if it's the only process
|
||||
needs_keepalive = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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.
|
||||
pid_t parent_pid = getpid();
|
||||
|
|
Loading…
Reference in New Issue
Block a user