diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2014-12-29 09:48:02 +0100 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2014-12-29 09:48:02 +0100 |
commit | 07789725a97de5879bca0c37242ec7b7c96aa270 (patch) | |
tree | e3140cbd33b4ae2bb402376e110db12179a80290 | |
parent | c8e9df5b209a2465f668283b5b71c0157d1e028f (diff) | |
download | biruda-07789725a97de5879bca0c37242ec7b7c96aa270.tar.gz biruda-07789725a97de5879bca0c37242ec7b7c96aa270.tar.bz2 |
printing worker exit code and message in worker output on termination
-rw-r--r-- | src/master.c | 12 |
1 files 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 ); |