mirror of
https://github.com/NixOS/nix
synced 2025-06-28 17:51:15 +02:00
refactor: RAII logger suspension
(cherry picked from commit 30694b5d8a
)
This commit is contained in:
parent
375df6c086
commit
ac3fc8876c
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