diff options
author | eldritch horrors <pennae@lix.systems> | 2024-03-04 05:38:09 +0100 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-03-04 05:38:09 +0100 |
commit | 6cb215f63b9d6fd624fe4a514489990dca46f917 (patch) | |
tree | 1d4bc61965524ac327d01a1de2ee6bcff5eeafbd /src/libstore/ssh.cc | |
parent | b7e79490358043deccb62431fe4516f1811232e1 (diff) |
Merge pull request #9293 from ThinkChaos/ssh-misc-improvments
SSH small improvments
(cherry picked from commit dcc49744ed0c3b91f905b0f3304d3ca700f9f717)
Change-Id: Ie87910df3ab739d0ff983c085190da1d108e96e2
Diffstat (limited to 'src/libstore/ssh.cc')
-rw-r--r-- | src/libstore/ssh.cc | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/libstore/ssh.cc b/src/libstore/ssh.cc index da32f1b79..fdae083ba 100644 --- a/src/libstore/ssh.cc +++ b/src/libstore/ssh.cc @@ -111,8 +111,10 @@ std::unique_ptr<SSHMaster::Connection> SSHMaster::startCommand(const std::string reply = readLine(out.readSide.get()); } catch (EndOfFile & e) { } - if (reply != "started") + if (reply != "started") { + printTalkative("SSH stdout first line: %s", reply); throw Error("failed to start SSH connection to '%s'", host); + } } conn->out = std::move(out.readSide); @@ -129,7 +131,6 @@ Path SSHMaster::startMaster() if (state->sshMaster != -1) return state->socketPath; - state->socketPath = (Path) *state->tmpDir + "/ssh.sock"; Pipe out; @@ -141,7 +142,8 @@ Path SSHMaster::startMaster() logger->pause(); Finally cleanup = [&]() { logger->resume(); }; - bool wasMasterRunning = isMasterRunning(); + if (isMasterRunning()) + return state->socketPath; state->sshMaster = startProcess([&]() { restoreProcessContext(); @@ -162,14 +164,14 @@ Path SSHMaster::startMaster() out.writeSide = -1; - if (!wasMasterRunning) { - std::string reply; - try { - reply = readLine(out.readSide.get()); - } catch (EndOfFile & e) { } + std::string reply; + try { + reply = readLine(out.readSide.get()); + } catch (EndOfFile & e) { } - if (reply != "started") - throw Error("failed to start SSH master connection to '%s'", host); + if (reply != "started") { + printTalkative("SSH master stdout first line: %s", reply); + throw Error("failed to start SSH master connection to '%s'", host); } return state->socketPath; |