From 36e3b43722a9546fc6caa4c54d432dff4540d8a4 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Thu, 20 Sep 2007 16:31:44 +0000 Subject: [PATCH] Add partial code for indicating to the output function that a command finished because of a timeout. [SVN r39416] --- historic/jam/src/execnt.c | 10 ++++++++-- historic/jam/src/execunix.c | 3 ++- historic/jam/src/make1.c | 2 +- historic/jam/src/output.c | 3 ++- historic/jam/src/output.h | 7 ++++++- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/historic/jam/src/execnt.c b/historic/jam/src/execnt.c index 4fc5c1b5f..67b2adbb9 100644 --- a/historic/jam/src/execnt.c +++ b/historic/jam/src/execnt.c @@ -129,11 +129,13 @@ static struct string buffer_err; /* running process info */ PROCESS_INFORMATION pi; - /* when comand complates, the result value */ + /* when comand completes, the result value */ DWORD exitcode; /* function called when the command completes */ void (*func)( void *closure, int status, timing_info*, char *, char * ); void *closure; + /* when command completes, the reason it completed */ + int exit_reason; } cmdtab[ MAXJOBS ] = {{0}}; /* execution unit tests */ @@ -518,7 +520,8 @@ int execwait() cmdtab[i].target.size > 0 ? cmdtab[i].target.value : 0, cmdtab[i].command.size > 0 ? cmdtab[i].command.value : 0, cmdtab[i].buffer_out.size > 0 ? cmdtab[i].buffer_out.value : 0, - cmdtab[i].buffer_err.size > 0 ? cmdtab[i].buffer_err.value : 0); + cmdtab[i].buffer_err.size > 0 ? cmdtab[i].buffer_err.value : 0, + cmdtab[i].exit_reason); /* call the callback, may call back to jam rule land. assume -p0 in effect so only pass buffer containing @@ -542,6 +545,7 @@ int execwait() string_free(&cmdtab[i].buffer_out); string_new(&cmdtab[i].buffer_out); string_free(&cmdtab[i].buffer_err); string_new(&cmdtab[i].buffer_err); cmdtab[i].exitcode = 0; + cmdtab[i].exit_reason = EXIT_OK; } return 1; @@ -915,6 +919,8 @@ static int try_kill_one() kill_process_tree(0,cmdtab[i].pi.hProcess); /* and return it as complete, with the failure code */ GetExitCodeProcess( cmdtab[i].pi.hProcess, &cmdtab[i].exitcode ); + /* mark it as a timeout */ + cmdtab[i].exit_reason = EXIT_TIMEOUT; return i; } } diff --git a/historic/jam/src/execunix.c b/historic/jam/src/execunix.c index e422062f7..50aa6a6c9 100644 --- a/historic/jam/src/execunix.c +++ b/historic/jam/src/execunix.c @@ -473,7 +473,8 @@ execwait() /* print out the rule and target name */ out_action(cmdtab[i].action, cmdtab[i].target, - cmdtab[i].command, cmdtab[i].buffer[OUT], cmdtab[i].buffer[ERR]); + cmdtab[i].command, cmdtab[i].buffer[OUT], cmdtab[i].buffer[ERR], + EXIT_OK); times(&new_time); diff --git a/historic/jam/src/make1.c b/historic/jam/src/make1.c index 0d44f24ed..5dda30bbe 100644 --- a/historic/jam/src/make1.c +++ b/historic/jam/src/make1.c @@ -513,7 +513,7 @@ make1c( state *pState ) target = lol_get(&cmd->args, 0)->string; if ( globs.noexec ) { - out_action(rule_name,target,cmd->buf,"",""); + out_action(rule_name,target,cmd->buf,"","",EXIT_OK); } } diff --git a/historic/jam/src/output.c b/historic/jam/src/output.c index 2c4215c36..6644c88e1 100644 --- a/historic/jam/src/output.c +++ b/historic/jam/src/output.c @@ -30,7 +30,8 @@ void out_action( const char * target, const char * command, const char * out_data, - const char * err_data + const char * err_data, + int exit_reason ) { /* print out the action+target line, if the action is quite diff --git a/historic/jam/src/output.h b/historic/jam/src/output.h index b0a6fb5ef..079c048a7 100644 --- a/historic/jam/src/output.h +++ b/historic/jam/src/output.h @@ -7,12 +7,17 @@ #ifndef BJAM_OUTPUT_H #define BJAM_OUTPUT_H +#define EXIT_OK 0 +#define EXIT_FAIL 1 +#define EXIT_TIMEOUT 2 + void out_action( const char * action, const char * target, const char * command, const char * out_data, - const char * err_data + const char * err_data, + int exit_reason ); #endif