From 9c896e199080bd4e219507961975a0ac97ebc32d Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 21 Aug 2022 16:25:26 -0700 Subject: [PATCH] Stop using posix_spawn when it is not allowed Commit 8b14ac4a9c3d0e15f9a7bd16a7633a9d1452b6d9 started using posix_spawn even if allow_use_posix_spawn() returns false. Stop doing that. This may be reproduced with: ./docker/docker_run_tests.sh ./docker/centos7.Dockerfile as centos7 has a too-old glibc. --- src/env_dispatch.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/env_dispatch.cpp b/src/env_dispatch.cpp index 9b3f08c80..c7d4f6403 100644 --- a/src/env_dispatch.cpp +++ b/src/env_dispatch.cpp @@ -250,11 +250,6 @@ static void handle_curses_change(const environment_t &vars) { init_curses(vars); } -/// 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; } - static constexpr bool allow_use_posix_spawn() { #if defined(FISH_USE_POSIX_SPAWN) // OpenBSD's posix_spawn returns status 127, instead of erroring with ENOEXEC, when faced with a @@ -273,6 +268,10 @@ 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 allow_use_posix_spawn() && g_use_posix_spawn; } + 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")) {