mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
Allow redeclaration of main process via setup_fork_guards()
This is necessary for the history race condition test to succeed. (That test is permanently disabled under WSL (as it always fails) so I didn't catch this on my end.)
This commit is contained in:
parent
b4301ff54f
commit
077d656b87
1 changed files with 9 additions and 0 deletions
|
@ -2177,6 +2177,15 @@ bool is_forked_child() {
|
|||
}
|
||||
|
||||
void setup_fork_guards() {
|
||||
static bool already_initialized = false;
|
||||
|
||||
is_forked_proc = false;
|
||||
if (already_initialized) {
|
||||
// Just mark this process as main and exit
|
||||
return;
|
||||
}
|
||||
|
||||
already_initialized = true;
|
||||
pthread_atfork(nullptr, nullptr, []() {
|
||||
is_forked_proc = true;
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue