Skip to content

Commit

Permalink
Propagate child process exit code properly
Browse files Browse the repository at this point in the history
Also when the child process was terminated by a signal.
  • Loading branch information
makortel committed Apr 24, 2024
1 parent b212c73 commit c9dd2cb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions FWCore/PluginManager/bin/refresh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,13 @@ int main(int argc, char** argv) try {
// Throw if any of the child died with non 0 status.
int status = 0;
waitpid(worker, &status, 0);
if (WIFEXITED(status) == true && status != 0) {
std::cerr << "Error while processing." << std::endl;
exit(status);
if (WIFEXITED(status) == true and WEXITSTATUS(status) != 0) {
std::cerr << "Error while processing: " << WEXITSTATUS(status) << std::endl;
exit(WEXITSTATUS(status));
}
if (WIFSIGNALED(status) == true) {
std::cerr << "Got signal while processing: " << WTERMSIG(status) << std::endl;
exit(WTERMSIG(status));
}
}
}
Expand Down

0 comments on commit c9dd2cb

Please sign in to comment.