MCPcopy Create free account
hub / github.com/boostorg/build / exec_wait

Function exec_wait

src/engine/execnt.c:358–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356 */
357
358void exec_wait()
359{
360 int i = -1;
361 int exit_reason; /* reason why a command completed */
362
363 /* Wait for a command to complete, while snarfing up any output. */
364 while ( 1 )
365 {
366 /* Check for a complete command, briefly. */
367 i = try_wait( 500 );
368 /* Read in the output of all running commands. */
369 read_output();
370 /* Close out pending debug style dialogs. */
371 close_alerts();
372 /* Process the completed command we found. */
373 if ( i >= 0 ) { exit_reason = EXIT_OK; break; }
374 /* Check if a command ran out of time. */
375 i = try_kill_one();
376 if ( i >= 0 ) { exit_reason = EXIT_TIMEOUT; break; }
377 }
378
379 /* We have a command... process it. */
380 {
381 DWORD exit_code;
382 timing_info time;
383 int rstat;
384
385 /* The time data for the command. */
386 record_times( cmdtab[ i ].pi.hProcess, &time );
387
388 /* Removed the used temporary command file. */
389 if ( cmdtab[ i ].command_file->size )
390 unlink( cmdtab[ i ].command_file->value );
391
392 /* Find out the process exit code. */
393 GetExitCodeProcess( cmdtab[ i ].pi.hProcess, &exit_code );
394
395 /* The dispossition of the command. */
396 if ( interrupted() )
397 rstat = EXEC_CMD_INTR;
398 else if ( exit_code )
399 rstat = EXEC_CMD_FAIL;
400 else
401 rstat = EXEC_CMD_OK;
402
403 /* Call the callback, may call back to jam rule land. */
404 (*cmdtab[ i ].func)( cmdtab[ i ].closure, rstat, &time,
405 cmdtab[ i ].buffer_out->value, cmdtab[ i ].buffer_err->value,
406 exit_reason );
407
408 /* Clean up our child process tracking data. No need to clear the
409 * temporary command file name as it gets reused.
410 */
411 closeWinHandle( &cmdtab[ i ].pi.hProcess );
412 closeWinHandle( &cmdtab[ i ].pi.hThread );
413 closeWinHandle( &cmdtab[ i ].pipe_out[ EXECCMD_PIPE_READ ] );
414 closeWinHandle( &cmdtab[ i ].pipe_out[ EXECCMD_PIPE_WRITE ] );
415 closeWinHandle( &cmdtab[ i ].pipe_err[ EXECCMD_PIPE_READ ] );

Callers 2

make1Function · 0.70
make1cFunction · 0.70

Calls 8

try_waitFunction · 0.85
read_outputFunction · 0.85
close_alertsFunction · 0.85
try_kill_oneFunction · 0.85
record_timesFunction · 0.85
interruptedFunction · 0.85
closeWinHandleFunction · 0.85
string_renewFunction · 0.85

Tested by

no test coverage detected