mirror of
https://github.com/NixOS/nix
synced 2025-06-27 04:21:16 +02:00
refactor: RAII logger suspension
This commit is contained in:
parent
880489051a
commit
30694b5d8a
7 changed files with 46 additions and 35 deletions
|
@ -306,15 +306,7 @@ void runProgram2(const RunOptions & options)
|
|||
// case), so we can't use it if we alter the environment
|
||||
processOptions.allowVfork = !options.environment;
|
||||
|
||||
std::optional<Finally<std::function<void()>>> resumeLoggerDefer;
|
||||
if (options.isInteractive) {
|
||||
logger->pause();
|
||||
resumeLoggerDefer.emplace(
|
||||
[]() {
|
||||
logger->resume();
|
||||
}
|
||||
);
|
||||
}
|
||||
auto suspension = logger->suspendIf(options.isInteractive);
|
||||
|
||||
/* Fork. */
|
||||
Pid pid = startProcess([&] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue