mirror of
https://github.com/NixOS/nix.git
synced 2025-11-11 21:16:02 +01: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
|
|
@ -117,10 +117,10 @@ std::unique_ptr<SSHMaster::Connection> SSHMaster::startCommand(
|
|||
ProcessOptions options;
|
||||
options.dieWithParent = false;
|
||||
|
||||
std::unique_ptr<Logger::Suspension> loggerSuspension;
|
||||
if (!fakeSSH && !useMaster) {
|
||||
logger->pause();
|
||||
loggerSuspension = std::make_unique<Logger::Suspension>(logger->suspend());
|
||||
}
|
||||
Finally cleanup = [&]() { logger->resume(); };
|
||||
|
||||
conn->sshPid = startProcess([&]() {
|
||||
restoreProcessContext();
|
||||
|
|
@ -199,8 +199,7 @@ Path SSHMaster::startMaster()
|
|||
ProcessOptions options;
|
||||
options.dieWithParent = false;
|
||||
|
||||
logger->pause();
|
||||
Finally cleanup = [&]() { logger->resume(); };
|
||||
auto suspension = logger->suspend();
|
||||
|
||||
if (isMasterRunning())
|
||||
return state->socketPath;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue