@@ -90,18 +90,20 @@ int ThreadExecutor::handleRead(int rpipe, unsigned int &result)
9090 if (errno == EAGAIN )
9191 return 0 ;
9292
93+ // need to increment so a missing pipe (i.e. premature exit of forked process) results in an error exitcode
94+ ++result;
9395 return -1 ;
9496 }
9597
9698 if (type != REPORT_OUT && type != REPORT_ERROR && type != REPORT_INFO && type != CHILD_END ) {
9799 std::cerr << " #### ThreadExecutor::handleRead error, type was:" << type << std::endl;
98- std::exit (0 );
100+ std::exit (EXIT_FAILURE );
99101 }
100102
101103 unsigned int len = 0 ;
102104 if (read (rpipe, &len, sizeof (len)) <= 0 ) {
103105 std::cerr << " #### ThreadExecutor::handleRead error, type was:" << type << std::endl;
104- std::exit (0 );
106+ std::exit (EXIT_FAILURE );
105107 }
106108
107109 // Don't rely on incoming data being null-terminated.
@@ -110,7 +112,7 @@ int ThreadExecutor::handleRead(int rpipe, unsigned int &result)
110112 const ssize_t readIntoBuf = read (rpipe, buf, len);
111113 if (readIntoBuf <= 0 ) {
112114 std::cerr << " #### ThreadExecutor::handleRead error, type was:" << type << std::endl;
113- std::exit (0 );
115+ std::exit (EXIT_FAILURE );
114116 }
115117 buf[readIntoBuf] = 0 ;
116118
@@ -230,7 +232,7 @@ unsigned int ThreadExecutor::check()
230232 std::ostringstream oss;
231233 oss << resultOfCheck;
232234 writeToPipe (CHILD_END , oss.str ());
233- std::exit (0 );
235+ std::exit (EXIT_SUCCESS );
234236 }
235237
236238 close (pipes[1 ]);
@@ -298,10 +300,10 @@ unsigned int ThreadExecutor::check()
298300 }
299301
300302 if (WIFEXITED (stat)) {
301- const int exitstaus = WEXITSTATUS (stat);
302- if (exitstaus != 0 ) {
303+ const int exitstatus = WEXITSTATUS (stat);
304+ if (exitstatus != EXIT_SUCCESS ) {
303305 std::ostringstream oss;
304- oss << " Child process exited with " << exitstaus ;
306+ oss << " Child process exited with " << exitstatus ;
305307 reportInternalChildErr (childname, oss.str ());
306308 }
307309 } else if (WIFSIGNALED (stat)) {
@@ -332,7 +334,7 @@ void ThreadExecutor::writeToPipe(PipeSignal type, const std::string &data)
332334 delete [] out;
333335 out = nullptr ;
334336 std::cerr << " #### ThreadExecutor::writeToPipe, Failed to write to pipe" << std::endl;
335- std::exit (0 );
337+ std::exit (EXIT_FAILURE );
336338 }
337339
338340 delete [] out;
@@ -517,7 +519,7 @@ void ThreadExecutor::reportErr(const ErrorMessage &msg)
517519
518520void ThreadExecutor::reportInfo (const ErrorMessage &msg)
519521{
520-
522+ report (msg, MessageType:: REPORT_INFO );
521523}
522524
523525void ThreadExecutor::bughuntingReport (const std::string &/* str*/ )
0 commit comments