forked from lix-project/lix
build-remote: Ugly hackery to get build logs to work
The build hook mechanism expects build log output to go to file descriptor 4, so do that.
This commit is contained in:
parent
3a5f04f48c
commit
feefcb3a98
|
@ -241,7 +241,7 @@ int main (int argc, char * * argv)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
Store::Params storeParams{{"max-connections", "1"}};
|
Store::Params storeParams{{"max-connections", "1"}, {"log-fd", "4"}};
|
||||||
if (bestMachine->sshKey != "")
|
if (bestMachine->sshKey != "")
|
||||||
storeParams["ssh-key"] = bestMachine->sshKey;
|
storeParams["ssh-key"] = bestMachine->sshKey;
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,9 @@ struct LegacySSHStore : public Store
|
||||||
const Setting<Path> sshKey{this, "", "ssh-key", "path to an SSH private key"};
|
const Setting<Path> sshKey{this, "", "ssh-key", "path to an SSH private key"};
|
||||||
const Setting<bool> compress{this, false, "compress", "whether to compress the connection"};
|
const Setting<bool> compress{this, false, "compress", "whether to compress the connection"};
|
||||||
|
|
||||||
|
// Hack for getting remote build log output.
|
||||||
|
const Setting<int> logFD{this, -1, "log-fd", "file descriptor to which SSH's stderr is connected"};
|
||||||
|
|
||||||
struct Connection
|
struct Connection
|
||||||
{
|
{
|
||||||
std::unique_ptr<SSHMaster::Connection> sshConn;
|
std::unique_ptr<SSHMaster::Connection> sshConn;
|
||||||
|
@ -44,7 +47,8 @@ struct LegacySSHStore : public Store
|
||||||
sshKey,
|
sshKey,
|
||||||
// Use SSH master only if using more than 1 connection.
|
// Use SSH master only if using more than 1 connection.
|
||||||
connections->capacity() > 1,
|
connections->capacity() > 1,
|
||||||
compress)
|
compress,
|
||||||
|
logFD)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,8 @@ std::unique_ptr<SSHMaster::Connection> SSHMaster::startCommand(const std::string
|
||||||
throw SysError("duping over stdin");
|
throw SysError("duping over stdin");
|
||||||
if (dup2(out.writeSide.get(), STDOUT_FILENO) == -1)
|
if (dup2(out.writeSide.get(), STDOUT_FILENO) == -1)
|
||||||
throw SysError("duping over stdout");
|
throw SysError("duping over stdout");
|
||||||
|
if (logFD != -1 && dup2(logFD, STDERR_FILENO) == -1)
|
||||||
|
throw SysError("duping over stderr");
|
||||||
|
|
||||||
Strings args = { "ssh", host.c_str(), "-x", "-a" };
|
Strings args = { "ssh", host.c_str(), "-x", "-a" };
|
||||||
addCommonSSHOpts(args);
|
addCommonSSHOpts(args);
|
||||||
|
|
|
@ -13,6 +13,7 @@ private:
|
||||||
const std::string keyFile;
|
const std::string keyFile;
|
||||||
const bool useMaster;
|
const bool useMaster;
|
||||||
const bool compress;
|
const bool compress;
|
||||||
|
const int logFD;
|
||||||
|
|
||||||
struct State
|
struct State
|
||||||
{
|
{
|
||||||
|
@ -27,11 +28,12 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SSHMaster(const std::string & host, const std::string & keyFile, bool useMaster, bool compress)
|
SSHMaster(const std::string & host, const std::string & keyFile, bool useMaster, bool compress, int logFD = -1)
|
||||||
: host(host)
|
: host(host)
|
||||||
, keyFile(keyFile)
|
, keyFile(keyFile)
|
||||||
, useMaster(useMaster)
|
, useMaster(useMaster)
|
||||||
, compress(compress)
|
, compress(compress)
|
||||||
|
, logFD(logFD)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue