Generates a textual description of a given exit code, in the format specified by wait(2).
| 7800 | // Generates a textual description of a given exit code, in the format |
| 7801 | // specified by wait(2). |
| 7802 | static std::string ExitSummary(int exit_code) { |
| 7803 | Message m; |
| 7804 | |
| 7805 | # if GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA |
| 7806 | |
| 7807 | m << "Exited with exit status " << exit_code; |
| 7808 | |
| 7809 | # else |
| 7810 | |
| 7811 | if (WIFEXITED(exit_code)) { |
| 7812 | m << "Exited with exit status " << WEXITSTATUS(exit_code); |
| 7813 | } else if (WIFSIGNALED(exit_code)) { |
| 7814 | m << "Terminated by signal " << WTERMSIG(exit_code); |
| 7815 | } |
| 7816 | # ifdef WCOREDUMP |
| 7817 | if (WCOREDUMP(exit_code)) { |
| 7818 | m << " (core dumped)"; |
| 7819 | } |
| 7820 | # endif |
| 7821 | # endif // GTEST_OS_WINDOWS || GTEST_OS_FUCHSIA |
| 7822 | |
| 7823 | return m.GetString(); |
| 7824 | } |
| 7825 | |
| 7826 | // Returns true if exit_status describes a process that was terminated |
| 7827 | // by a signal, or exited normally with a nonzero exit code. |