diff options
author | Alois Wohlschlager <alois1@gmx-topmail.de> | 2024-08-02 18:32:24 +0200 |
---|---|---|
committer | Alois Wohlschlager <alois1@gmx-topmail.de> | 2024-08-02 18:38:14 +0200 |
commit | a93dade82118c68b3656ffb40d6a48ab66f2aa1a (patch) | |
tree | 5edc7c26badb5bf49770f34d652c3d6c43aab106 /src/libstore/ssh.cc | |
parent | 61a93d53081141d4ab222dcb939dd5caa8ffc767 (diff) |
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
with 0dd1d8ca1cdccfc620644a7f690ed35bcd2d1e74, 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: https://git.lix.systems/lix-project/lix/issues/458
Change-Id: Ib1e4d047744a129f15730b7216f9c9368c2f4211
Diffstat (limited to 'src/libstore/ssh.cc')
-rw-r--r-- | src/libstore/ssh.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstore/ssh.cc b/src/libstore/ssh.cc index 0d7bfa01d..8386b0e0a 100644 --- a/src/libstore/ssh.cc +++ b/src/libstore/ssh.cc @@ -65,10 +65,11 @@ std::unique_ptr<SSHMaster::Connection> SSHMaster::startCommand(const std::string ProcessOptions options; options.dieWithParent = false; + std::optional<Finally<std::function<void()>>> resumeLoggerDefer; if (!fakeSSH && !useMaster) { logger->pause(); + resumeLoggerDefer.emplace([&]() { logger->resume(); }); } - Finally cleanup = [&]() { logger->resume(); }; conn->sshPid = startProcess([&]() { restoreProcessContext(); |