Stop using posix_spawn when it is not allowed

Commit 8b14ac4a9c 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.
This commit is contained in:
ridiculousfish 2022-08-21 16:25:26 -07:00
parent 60621e086c
commit 9c896e1990

View File

@ -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")) {