==================== The following three methods all try to modify the process handle. So only one successful invocation is allowed. Otherwise, later invocation results in undefined behavior.
| 120 | // So only one successful invocation is allowed. Otherwise, later |
| 121 | // invocation results in undefined behavior. |
| 122 | void Kill(bool force = false) { |
| 123 | if (killed_) return; |
| 124 | if (force) { |
| 125 | process_->kill(false); |
| 126 | while (!process_->try_get_exit_status(exit_code_)) { |
| 127 | fma_common::SleepS(0.1); |
| 128 | process_->kill(true); |
| 129 | } |
| 130 | } else { |
| 131 | process_->kill(false); |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | int Wait() { |
| 136 | if (killed_) return exit_code_; |
no test coverage detected