libstore/ssh: only resume the logger when we paused it
In the SSH code, the logger was conditionally paused, but unconditionally resumed. This was fine as long as resuming the logger was idempotent. Starting with0dd1d8ca1c
, it isn't any more, and the behaviour of the code in question was missed. Consequently, an assertion failure is triggered for example when performing builds against an "SSH" store on localhost. Fix the issue by only resuming the logger when it has actually been paused. Fixes: #458 Change-Id:Ib1e4d047744a129f15730b7216f9c9368c2f4211
This commit is contained in:
parent
61a93d5308
commit
a93dade821
|
@ -65,10 +65,11 @@ std::unique_ptr<SSHMaster::Connection> SSHMaster::startCommand(const std::string
|
||||||
ProcessOptions options;
|
ProcessOptions options;
|
||||||
options.dieWithParent = false;
|
options.dieWithParent = false;
|
||||||
|
|
||||||
|
std::optional<Finally<std::function<void()>>> resumeLoggerDefer;
|
||||||
if (!fakeSSH && !useMaster) {
|
if (!fakeSSH && !useMaster) {
|
||||||
logger->pause();
|
logger->pause();
|
||||||
|
resumeLoggerDefer.emplace([&]() { logger->resume(); });
|
||||||
}
|
}
|
||||||
Finally cleanup = [&]() { logger->resume(); };
|
|
||||||
|
|
||||||
conn->sshPid = startProcess([&]() {
|
conn->sshPid = startProcess([&]() {
|
||||||
restoreProcessContext();
|
restoreProcessContext();
|
||||||
|
|
Loading…
Reference in a new issue