mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-20 16:57:47 +08:00
Further fix the issue and add the assert that'd have prevented it.
Surprise: because FISH_USE_POSIX_SPAWN was from postfork.h, we also were disabling things when we don't want to as well.
This commit is contained in:
parent
85b9f3c71f
commit
056502001e
|
@ -298,8 +298,6 @@ class env_stack_t final : public environment_t {
|
|||
static env_stack_t &globals();
|
||||
};
|
||||
|
||||
bool get_use_posix_spawn();
|
||||
|
||||
extern bool term_has_xn; // does the terminal have the "eat_newline_glitch"
|
||||
|
||||
/// Returns true if we think the terminal supports setting its title.
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "input_common.h"
|
||||
#include "maybe.h"
|
||||
#include "output.h"
|
||||
#include "postfork.h"
|
||||
#include "proc.h"
|
||||
#include "reader.h"
|
||||
#include "screen.h"
|
||||
|
@ -268,10 +269,13 @@ static constexpr bool allow_use_posix_spawn() {
|
|||
#endif
|
||||
}
|
||||
|
||||
/// Whether to use posix_spawn when possible.
|
||||
static relaxed_atomic_bool_t g_use_posix_spawn{false};
|
||||
bool get_use_posix_spawn() { return g_use_posix_spawn; }
|
||||
bool get_use_posix_spawn() {
|
||||
assert(allow_use_posix_spawn() && "get_use_posix_spawn() called but not allowed");
|
||||
return g_use_posix_spawn;
|
||||
}
|
||||
|
||||
/// Whether to use posix_spawn when possible.
|
||||
static void handle_fish_use_posix_spawn_change(const environment_t &vars) {
|
||||
// If the variable is missing or empty, we default to true if allowed.
|
||||
if (auto var = vars.get(L"fish_use_posix_spawn")) {
|
||||
|
@ -354,7 +358,7 @@ static void run_inits(const environment_t &vars) {
|
|||
guess_emoji_width(vars);
|
||||
update_wait_on_escape_ms(vars);
|
||||
handle_read_limit_change(vars);
|
||||
if (allow_use_posix_spawn) handle_fish_use_posix_spawn_change(vars);
|
||||
if (allow_use_posix_spawn()) handle_fish_use_posix_spawn_change(vars);
|
||||
handle_fish_trace(vars);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,4 +15,7 @@ void env_dispatch_init(const environment_t &vars);
|
|||
/// React to changes in variables like LANG which require running some code.
|
||||
void env_dispatch_var_change(const wcstring &key, env_stack_t &vars);
|
||||
|
||||
/// Whether posix_spawn is configured and/or allowed to be in use globally.
|
||||
bool get_use_posix_spawn();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "builtin.h"
|
||||
#include "common.h"
|
||||
#include "env.h"
|
||||
#include "env_dispatch.h"
|
||||
#include "exec.h"
|
||||
#include "fallback.h" // IWYU pragma: keep
|
||||
#include "fds.h"
|
||||
|
|
Loading…
Reference in New Issue
Block a user