src/utils/command.cpp
/**
 * Wait for the child process to finish
 */
Wait for the child process to finish
Wait for the child process to finish
int command<output_policy::IGNORED>::wait() {
  do {
    m_log.trace("command: Waiting for pid %d to finish...", m_forkpid);
    process_util::wait_for_completion(m_forkpid, &m_forkstatus, WCONTINUED | WUNTRACED);
    if (WIFEXITED(m_forkstatus) && m_forkstatus > 0) {
      m_log.trace("command: Exited with failed status %d", WEXITSTATUS(m_forkstatus));
    } else if (WIFEXITED(m_forkstatus)) {
      m_log.trace("command: Exited with status %d", WEXITSTATUS(m_forkstatus));
    } else if (WIFSIGNALED(m_forkstatus)) {
      m_log.trace("command: killed by signal %d", WTERMSIG(m_forkstatus));
    } else if (WIFSTOPPED(m_forkstatus)) {
      m_log.trace("command: Stopped by signal %d", WSTOPSIG(m_forkstatus));
    } else if (WIFCONTINUED(m_forkstatus)) {
      m_log.trace("command: Continued");
    } else {
      break;
    }
  } while (!WIFEXITED(m_forkstatus) && !WIFSIGNALED(m_forkstatus));
  return WEXITSTATUS(m_forkstatus);
}
int command < output_policy :: IGNORED > :: wait ( ) { do { m_log . trace ( " " , m_forkpid ) ; process_util :: wait_for_completion ( m_forkpid , & m_forkstatus , WCONTINUED | WUNTRACED ) ; if ( WIFEXITED ( m_forkstatus ) && m_forkstatus > 0 ) { m_log . trace ( " " , WEXITSTATUS ( m_forkstatus ) ) ; } else if ( WIFEXITED ( m_forkstatus ) ) { m_log . trace ( " " , WEXITSTATUS ( m_forkstatus ) ) ; } else if ( WIFSIGNALED ( m_forkstatus ) ) { m_log . trace ( " " , WTERMSIG ( m_forkstatus ) ) ; } else if ( WIFSTOPPED ( m_forkstatus ) ) { m_log . trace ( " " , WSTOPSIG ( m_forkstatus ) ) ; } else if ( WIFCONTINUED ( m_forkstatus ) ) { m_log . trace ( " " ) ; } else { break ; } } while ( ! WIFEXITED ( m_forkstatus ) && ! WIFSIGNALED ( m_forkstatus ) ) ; return WEXITSTATUS ( m_forkstatus ) ; }
Wait for the child process to finish
Wait for the child process to finish