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

allocate SimpleLogger before forking

This commit is contained in:
Philipp Otterbein 2025-04-28 00:46:44 +02:00
parent 155411397d
commit 4e95f662db

View file

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