mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Migrate fish_use_posix_spawn into env_dispatch
This commit is contained in:
parent
e7de9cc371
commit
ab67354192
2 changed files with 11 additions and 6 deletions
|
@ -81,7 +81,6 @@ size_t read_byte_limit = READ_BYTE_LIMIT;
|
|||
static const wchar_t PATH_ARRAY_SEP = L':';
|
||||
static const wchar_t NONPATH_ARRAY_SEP = L' ';
|
||||
|
||||
bool g_use_posix_spawn = false; // will usually be set to true
|
||||
bool curses_initialized = false;
|
||||
|
||||
/// Does the terminal have the "eat_newline_glitch".
|
||||
|
@ -779,11 +778,6 @@ void env_init(const struct config_paths_t *paths /* or NULL */) {
|
|||
vars.set_termsize(); // initialize the terminal size variables
|
||||
vars.set_read_limit(); // initialize the read_byte_limit
|
||||
|
||||
// Set g_use_posix_spawn. Default to true.
|
||||
auto use_posix_spawn = vars.get(L"fish_use_posix_spawn");
|
||||
g_use_posix_spawn =
|
||||
use_posix_spawn.missing_or_empty() ? true : bool_from_string(use_posix_spawn->as_string());
|
||||
|
||||
// Set fish_bind_mode to "default".
|
||||
vars.set_one(FISH_BIND_MODE_VAR, ENV_GLOBAL, DEFAULT_BIND_MODE);
|
||||
|
||||
|
|
|
@ -300,6 +300,13 @@ static void handle_curses_change(const environment_t &vars) {
|
|||
init_curses(vars);
|
||||
}
|
||||
|
||||
static void handle_fish_use_posix_spawn_change(const environment_t &vars) {
|
||||
// note this defaults to true
|
||||
auto use_posix_spawn = vars.get(L"fish_use_posix_spawn");
|
||||
g_use_posix_spawn =
|
||||
use_posix_spawn.missing_or_empty() ? true : bool_from_string(use_posix_spawn->as_string());
|
||||
}
|
||||
|
||||
/// Populate the dispatch table used by `env_dispatch_var_change()` to efficiently call the
|
||||
/// appropriate function to handle a change to a variable.
|
||||
/// Note this returns a new-allocated value that we expect to leak.
|
||||
|
@ -327,6 +334,7 @@ static std::unique_ptr<const var_dispatch_table_t> create_dispatch_table() {
|
|||
var_dispatch_table->add(L"fish_read_limit", handle_read_limit_change);
|
||||
var_dispatch_table->add(L"fish_history", handle_fish_history_change);
|
||||
var_dispatch_table->add(L"TZ", handle_tz_change);
|
||||
var_dispatch_table->add(L"fish_use_posix_spawn", handle_fish_use_posix_spawn_change);
|
||||
return var_dispatch_table;
|
||||
}
|
||||
|
||||
|
@ -336,3 +344,6 @@ static void run_inits(const environment_t &vars) {
|
|||
handle_curses_change(vars);
|
||||
update_wait_on_escape_ms(vars);
|
||||
}
|
||||
|
||||
// Miscellaneous variables.
|
||||
bool g_use_posix_spawn = false;
|
||||
|
|
Loading…
Reference in a new issue