mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-07 01:51:14 -03: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:
@@ -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;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user