Generates a textual description of a given exit code, in the format specified by wait(2).
| 6338 | // Generates a textual description of a given exit code, in the format |
| 6339 | // specified by wait(2). |
| 6340 | static String ExitSummary(int exit_code) { |
| 6341 | Message m; |
| 6342 | |
| 6343 | # if GTEST_OS_WINDOWS |
| 6344 | |
| 6345 | m << "Exited with exit status " << exit_code; |
| 6346 | |
| 6347 | # else |
| 6348 | |
| 6349 | if (WIFEXITED(exit_code)) { |
| 6350 | m << "Exited with exit status " << WEXITSTATUS(exit_code); |
| 6351 | } else if (WIFSIGNALED(exit_code)) { |
| 6352 | m << "Terminated by signal " << WTERMSIG(exit_code); |
| 6353 | } |
| 6354 | # ifdef WCOREDUMP |
| 6355 | if (WCOREDUMP(exit_code)) { |
| 6356 | m << " (core dumped)"; |
| 6357 | } |
| 6358 | # endif |
| 6359 | # endif // GTEST_OS_WINDOWS |
| 6360 | |
| 6361 | return m.GetString(); |
| 6362 | } |
| 6363 | |
| 6364 | // Returns true if exit_status describes a process that was terminated |
| 6365 | // by a signal, or exited normally with a nonzero exit code. |