mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-30 22:34:29 +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
10
src/exec.cpp
10
src/exec.cpp
|
@ -577,14 +577,16 @@ void exec_job(parser_t &parser, job_t *j) {
|
||||||
needs_keepalive = true;
|
needs_keepalive = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// When running under WSL, create a keepalive process unconditionally if our first process is external.
|
// 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.
|
// 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
|
// (see https://github.com/Microsoft/WSL/issues/2786), also fish PR #4676
|
||||||
if (j->processes.front()->type == EXTERNAL && is_windows_subsystem_for_linux())
|
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;
|
needs_keepalive = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (needs_keepalive) {
|
if (needs_keepalive) {
|
||||||
// Call fork. No need to wait for threads since our use is confined and simple.
|
// Call fork. No need to wait for threads since our use is confined and simple.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user