Skip to content

Commit 4d4a91a

Browse files
authored
Merge pull request NixOS#13101 from NixOS/mergify/bp/2.28-maintenance/pr-13100
allocate SimpleLogger before forking (backport NixOS#13100)
2 parents 323e840 + 9ba32a2 commit 4d4a91a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libutil/unix/processes.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ static int childEntry(void * arg)
202202

203203
pid_t startProcess(std::function<void()> fun, const ProcessOptions & options)
204204
{
205+
auto newLogger = makeSimpleLogger();
205206
ChildWrapperFunction wrapper = [&] {
206207
if (!options.allowVfork) {
207208
/* Set a simple logger, while releasing (not destroying)
@@ -210,7 +211,7 @@ pid_t startProcess(std::function<void()> fun, const ProcessOptions & options)
210211
~ProgressBar() tries to join a thread that doesn't
211212
exist. */
212213
logger.release();
213-
logger = makeSimpleLogger();
214+
logger = std::move(newLogger);
214215
}
215216
try {
216217
#ifdef __linux__

0 commit comments

Comments
 (0)