mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
* Propagate the "100" exit status for failed builds through the Nix
daemon.
This commit is contained in:
parent
eac93d6efe
commit
b1eb252172
3 changed files with 9 additions and 5 deletions
|
@ -509,8 +509,11 @@ void RemoteStore::processStderr(Sink * sink, Source * source)
|
||||||
writeToStderr((const unsigned char *) s.c_str(), s.size());
|
writeToStderr((const unsigned char *) s.c_str(), s.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (msg == STDERR_ERROR)
|
if (msg == STDERR_ERROR) {
|
||||||
throw Error(readString(from));
|
string error = readString(from);
|
||||||
|
unsigned int status = GET_PROTOCOL_MINOR(daemonVersion) >= 8 ? readInt(from) : 1;
|
||||||
|
throw Error(error, status);
|
||||||
|
}
|
||||||
else if (msg != STDERR_LAST)
|
else if (msg != STDERR_LAST)
|
||||||
throw Error("protocol error processing standard error");
|
throw Error("protocol error processing standard error");
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace nix {
|
||||||
#define WORKER_MAGIC_1 0x6e697863
|
#define WORKER_MAGIC_1 0x6e697863
|
||||||
#define WORKER_MAGIC_2 0x6478696f
|
#define WORKER_MAGIC_2 0x6478696f
|
||||||
|
|
||||||
#define PROTOCOL_VERSION 0x107
|
#define PROTOCOL_VERSION 0x108
|
||||||
#define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00)
|
#define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00)
|
||||||
#define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff)
|
#define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff)
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,7 @@ static void startWork()
|
||||||
|
|
||||||
/* stopWork() means that we're done; stop sending stderr to the
|
/* stopWork() means that we're done; stop sending stderr to the
|
||||||
client. */
|
client. */
|
||||||
static void stopWork(bool success = true, const string & msg = "")
|
static void stopWork(bool success = true, const string & msg = "", unsigned int status = 0)
|
||||||
{
|
{
|
||||||
/* Stop handling async client death; we're going to a state where
|
/* Stop handling async client death; we're going to a state where
|
||||||
we're either sending or receiving from the client, so we'll be
|
we're either sending or receiving from the client, so we'll be
|
||||||
|
@ -192,6 +192,7 @@ static void stopWork(bool success = true, const string & msg = "")
|
||||||
else {
|
else {
|
||||||
writeInt(STDERR_ERROR, to);
|
writeInt(STDERR_ERROR, to);
|
||||||
writeString(msg, to);
|
writeString(msg, to);
|
||||||
|
if (status != 0) writeInt(status, to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,7 +638,7 @@ static void processConnection()
|
||||||
try {
|
try {
|
||||||
performOp(clientVersion, from, to, op);
|
performOp(clientVersion, from, to, op);
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
stopWork(false, e.msg());
|
stopWork(false, e.msg(), GET_PROTOCOL_MINOR(clientVersion) >= 8 ? e.status : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(!canSendStderr);
|
assert(!canSendStderr);
|
||||||
|
|
Loading…
Reference in a new issue