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.
This commit is contained in:
oxmox 2023-02-21 23:03:39 +01:00
parent 0639476d91
commit eea3377406

View file

@ -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 // TODO: Close stdin and stdout? Leave them open for now to see the logging
// output. // 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; pid_t pid;
if (auto err = posix_spawn(&pid, DOOM_EXECUTABLE, nullptr, nullptr, if (auto err = posix_spawn(&pid, DOOM_EXECUTABLE, nullptr, nullptr,
const_cast<char *const *>(argv), nullptr)) const_cast<char *const *>(argv), __environ))
{ {
log_error("Could not spawn doom: %s", strerror(err)); log_error("Could not spawn %s: %s", DOOM_EXECUTABLE, strerror(err));
return; 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) inline void spawn_doom(ControllerContext &ctx)