Boost logo

Boost-Commit :

From: grafikrobot_at_[hidden]
Date: 2007-09-20 12:31:45


Author: grafik
Date: 2007-09-20 12:31:44 EDT (Thu, 20 Sep 2007)
New Revision: 39416
URL: http://svn.boost.org/trac/boost/changeset/39416

Log:
Add partial code for indicating to the output function that a command finished because of a timeout.
Text files modified:
   trunk/tools/jam/src/execnt.c | 10 ++++++++--
   trunk/tools/jam/src/execunix.c | 3 ++-
   trunk/tools/jam/src/make1.c | 2 +-
   trunk/tools/jam/src/output.c | 3 ++-
   trunk/tools/jam/src/output.h | 7 ++++++-
   5 files changed, 19 insertions(+), 6 deletions(-)

Modified: trunk/tools/jam/src/execnt.c
==============================================================================
--- trunk/tools/jam/src/execnt.c (original)
+++ trunk/tools/jam/src/execnt.c 2007-09-20 12:31:44 EDT (Thu, 20 Sep 2007)
@@ -129,11 +129,13 @@
     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 @@
             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 @@
         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 @@
                 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;
             }
         }

Modified: trunk/tools/jam/src/execunix.c
==============================================================================
--- trunk/tools/jam/src/execunix.c (original)
+++ trunk/tools/jam/src/execunix.c 2007-09-20 12:31:44 EDT (Thu, 20 Sep 2007)
@@ -473,7 +473,8 @@
 
                         /* 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);
 

Modified: trunk/tools/jam/src/make1.c
==============================================================================
--- trunk/tools/jam/src/make1.c (original)
+++ trunk/tools/jam/src/make1.c 2007-09-20 12:31:44 EDT (Thu, 20 Sep 2007)
@@ -513,7 +513,7 @@
             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);
             }
             }
 

Modified: trunk/tools/jam/src/output.c
==============================================================================
--- trunk/tools/jam/src/output.c (original)
+++ trunk/tools/jam/src/output.c 2007-09-20 12:31:44 EDT (Thu, 20 Sep 2007)
@@ -30,7 +30,8 @@
     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

Modified: trunk/tools/jam/src/output.h
==============================================================================
--- trunk/tools/jam/src/output.h (original)
+++ trunk/tools/jam/src/output.h 2007-09-20 12:31:44 EDT (Thu, 20 Sep 2007)
@@ -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


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk