Skip to content

Commit

Permalink
more echo'ing of process exit info in model_interface
Browse files Browse the repository at this point in the history
  • Loading branch information
jtwhite79 committed Oct 14, 2024
1 parent 69f17ca commit 4d462e8
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/libs/run_managers/abstract_base/model_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,10 @@ void ModelInterface::run(pest_utils::thread_flag* terminate, pest_utils::thread_
cout << "exit_code: " << exitcode << endl;
throw std::runtime_error("GetExitCodeProcess() returned error status for command: " + cmd_string);
}
if (should_echo)
{
cout << "...exit_code: " << exitcode << endl;
}
break;
}
//else cout << exitcode << "...still waiting for command " << cmd_string << endl;
Expand Down Expand Up @@ -765,16 +769,22 @@ void ModelInterface::run(pest_utils::thread_flag* terminate, pest_utils::thread_
//check if process is still active
int status = 0;
pid_t exit_code = waitpid(command_pid, &status, WNOHANG);
//if the process ended, break

//if the process ended, break
if ((exit_code == -1) || (status != 0))
{
cout << "exit_code: " << exit_code << endl;
cout << "status: " << status << endl;
finished->set(true);
cout << "exit_code: " << exit_code << endl;
cout << "status: " << status << endl;
throw std::runtime_error("waitpid() returned error status for command: " + cmd_string);
}
else if (exit_code != 0)
{
if (should_echo)
{
cout << "...exit_code: " << exit_code << endl;
cout << "...status: " << status << endl;
}
break;
}
//check for termination flag
Expand Down

0 comments on commit 4d462e8

Please sign in to comment.