From 07789725a97de5879bca0c37242ec7b7c96aa270 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Mon, 29 Dec 2014 09:48:02 +0100 Subject: printing worker exit code and message in worker output on termination --- src/master.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/master.c b/src/master.c index e8caca9..a7dbc26 100644 --- a/src/master.c +++ b/src/master.c @@ -441,9 +441,17 @@ static int master_output_write_terminated( const char *spool_dir, const char *na json_object *ts_obj; json_object_object_get_ex( obj, "timestamp", &ts_obj ); time_t ts = json_object_get_int( ts_obj ); - + + json_object *exit_code_obj; + json_object_object_get_ex( obj, "exit_status", &exit_code_obj ); + int exit_code = json_object_get_int( exit_code_obj ); + + json_object *exit_message_obj; + json_object_object_get_ex( obj, "exit_message", &exit_message_obj ); + const char *exit_message = json_object_get_string( exit_message_obj ); + char line[1024]; - snprintf( line, sizeof( line ), "%lu %s --- STOPPED %s ---\n", ts, name, pid_str ); + snprintf( line, sizeof( line ), "%lu %s --- STOPPED %s (%d, %s)---\n", ts, name, pid_str, exit_code, exit_message ); fputs( line, wed->spool_file ); fflush( wed->spool_file ); -- cgit v1.2.3-54-g00ecf