Write the exit code
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details

pull/3/head
Clément FRÉVILLE 2 years ago
parent c1cca106b7
commit 65b83d45a1

@ -107,10 +107,11 @@ int main(int argc, char **argv) {
std::cout << "Result: " << result.out << std::endl;
// Send the job id and result.out to sink
zmq::message_t reply(JOB_ID_LEN + result.out.size());
// Send the job id, the exit code and result.out to sink
zmq::message_t reply(JOB_ID_LEN + sizeof(uint32_t) + result.out.size());
memcpy(reply.data(), jobId.data(), JOB_ID_LEN);
memcpy(static_cast<char *>(reply.data()) + JOB_ID_LEN, result.out.data(), result.out.size());
sk::write_uint32(static_cast<char *>(reply.data()) + JOB_ID_LEN, result.exit_code);
memcpy(static_cast<char *>(reply.data()) + JOB_ID_LEN + sizeof(uint32_t), result.out.data(), result.out.size());
sender.send(reply, zmq::send_flags::none);
}
return 0;

@ -2,4 +2,10 @@
namespace sk {
uint32_t read_uint32(const char *buffer) { return static_cast<uint32_t>(buffer[3]) | static_cast<uint32_t>(buffer[2]) << 8 | static_cast<uint32_t>(buffer[1]) << 16 | static_cast<uint32_t>(buffer[0]) << 24; }
void write_uint32(char *buffer, uint32_t value) {
buffer[0] = static_cast<char>(value >> 24);
buffer[1] = static_cast<char>(value >> 16);
buffer[2] = static_cast<char>(value >> 8);
buffer[3] = static_cast<char>(value);
}
}

@ -4,4 +4,5 @@
namespace sk {
uint32_t read_uint32(const char *buffer);
void write_uint32(char *buffer, uint32_t value);
}

Loading…
Cancel
Save