1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 02:21:16 +02:00

allocate SimpleLogger before forking

(cherry picked from commit 4e95f662db)
This commit is contained in:
Philipp Otterbein 2025-04-28 00:46:44 +02:00 committed by Mergify
parent 323e840d17
commit 9ba32a2981

View file

@ -202,6 +202,7 @@ static int childEntry(void * arg)
pid_t startProcess(std::function<void()> fun, const ProcessOptions & options)
{
auto newLogger = makeSimpleLogger();
ChildWrapperFunction wrapper = [&] {
if (!options.allowVfork) {
/* Set a simple logger, while releasing (not destroying)
@ -210,7 +211,7 @@ pid_t startProcess(std::function<void()> fun, const ProcessOptions & options)
~ProgressBar() tries to join a thread that doesn't
exist. */
logger.release();
logger = makeSimpleLogger();
logger = std::move(newLogger);
}
try {
#ifdef __linux__