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

Function exec_wait

src/engine/execnt.cpp:427–489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

425 */
426
427void exec_wait()
428{
429 int32_t i = -1;
430 int32_t exit_reason; /* reason why a command completed */
431
432 /* Wait for a command to complete, while snarfing up any output. */
433 while ( 1 )
434 {
435 /* Check for a complete command, briefly. */
436 i = try_wait( 500 );
437 /* Read in the output of all running commands. */
438 read_output();
439 /* Close out pending debug style dialogs. */
440 close_alerts();
441 /* Process the completed command we found. */
442 if ( i >= 0 ) { exit_reason = EXIT_OK; break; }
443 /* Check if a command ran out of time. */
444 i = try_kill_one();
445 if ( i >= 0 ) { exit_reason = EXIT_TIMEOUT; break; }
446 }
447
448 /* We have a command... process it. */
449 {
450 DWORD exit_code;
451 timing_info time;
452 int32_t rstat;
453
454 /* The time data for the command. */
455 record_times( cmdtab[ i ].pi.hProcess, &time );
456
457 /* Removed the used temporary command file. */
458 if ( cmdtab[ i ].command_file->size )
459 unlink( cmdtab[ i ].command_file->value );
460
461 /* Find out the process exit code. */
462 GetExitCodeProcess( cmdtab[ i ].pi.hProcess, &exit_code );
463
464 /* The dispossition of the command. */
465 if ( interrupted() )
466 rstat = EXEC_CMD_INTR;
467 else if ( exit_code )
468 rstat = EXEC_CMD_FAIL;
469 else
470 rstat = EXEC_CMD_OK;
471
472 /* Call the callback, may call back to jam rule land. */
473 (*cmdtab[ i ].func)( cmdtab[ i ].closure, rstat, &time,
474 cmdtab[ i ].buffer_out->value, cmdtab[ i ].buffer_err->value,
475 exit_reason );
476
477 /* Clean up our child process tracking data. No need to clear the
478 * temporary command file name as it gets reused.
479 */
480 closeWinHandle( &cmdtab[ i ].pi.hProcess );
481 closeWinHandle( &cmdtab[ i ].pi.hThread );
482 closeWinHandle( &cmdtab[ i ].pipe_out[ EXECCMD_PIPE_READ ] );
483 closeWinHandle( &cmdtab[ i ].pipe_out[ EXECCMD_PIPE_WRITE ] );
484 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