| 206 | |
| 207 | #ifndef _WIN32 |
| 208 | void RunInChild(std::function<void()> func) { |
| 209 | auto child_pid = fork(); |
| 210 | if (child_pid == -1) { |
| 211 | ASSERT_OK(internal::IOErrorFromErrno(errno, "Error calling fork(): ")); |
| 212 | } |
| 213 | if (child_pid == 0) { |
| 214 | // Child |
| 215 | ASSERT_NO_FATAL_FAILURE(func()) << "Failure in child process"; |
| 216 | std::exit(0); |
| 217 | } else { |
| 218 | // Parent |
| 219 | AssertChildExit(child_pid); |
| 220 | } |
| 221 | } |
| 222 | #endif |
| 223 | |
| 224 | protected: |
nothing calls this directly
no test coverage detected