mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 15:19:11 +08: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
@ -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…
x
Reference in New Issue
Block a user