From eea33774065ebb841ae7c48bc4dfe2ae58248b10 Mon Sep 17 00:00:00 2001 From: oxmox Date: Tue, 21 Feb 2023 23:03:39 +0100 Subject: [PATCH] finally fix dooms not being able to output sound It was just the empty environment after posix_spawn() that caused SDL_INIT_AUDIO to fail. __environ fixes that. --- src/doompanning.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/doompanning.cc b/src/doompanning.cc index dbe575d..91ddbab 100644 --- a/src/doompanning.cc +++ b/src/doompanning.cc @@ -113,17 +113,15 @@ void spawn_doom_posix_spawn(ControllerContext &ctx) // TODO: Close stdin and stdout? Leave them open for now to see the logging // output. - // FIXME: SDL is not able to init its sound system in the doomchild. Try - // something similar to xdg-open where a doomgrandchild execvp()s the doom. pid_t pid; if (auto err = posix_spawn(&pid, DOOM_EXECUTABLE, nullptr, nullptr, - const_cast(argv), nullptr)) + const_cast(argv), __environ)) { - log_error("Could not spawn doom: %s", strerror(err)); + log_error("Could not spawn %s: %s", DOOM_EXECUTABLE, strerror(err)); return; } - log_info("Spawned new doom, pid=%d", pid); + log_info("Spawned new %s, pid=%d", DOOM_EXECUTABLE, pid); } inline void spawn_doom(ControllerContext &ctx)