| 198 | } |
| 199 | |
| 200 | bool OrganizerProxy::waitForApplication(HANDLE handle, bool refresh, |
| 201 | LPDWORD exitCode) const |
| 202 | { |
| 203 | const auto pid = ::GetProcessId(handle); |
| 204 | |
| 205 | log::debug("a plugin wants to wait for an application to complete, pid {}{}", pid, |
| 206 | (pid == 0 ? "unknown (probably already completed)" : "")); |
| 207 | |
| 208 | auto runner = m_Proxied->processRunner(); |
| 209 | |
| 210 | ProcessRunner::WaitFlags waitFlags = ProcessRunner::ForceWait; |
| 211 | |
| 212 | if (refresh) { |
| 213 | waitFlags |= ProcessRunner::TriggerRefresh | ProcessRunner::WaitForRefresh; |
| 214 | } |
| 215 | |
| 216 | const auto r = runner.setWaitForCompletion(waitFlags, UILocker::OutputRequired) |
| 217 | .attachToProcess(handle); |
| 218 | |
| 219 | if (exitCode) { |
| 220 | *exitCode = runner.exitCode(); |
| 221 | } |
| 222 | |
| 223 | switch (r) { |
| 224 | case ProcessRunner::Completed: |
| 225 | return true; |
| 226 | |
| 227 | case ProcessRunner::Cancelled: // fall-through |
| 228 | case ProcessRunner::ForceUnlocked: |
| 229 | // this is always an error because the application should have run to |
| 230 | // completion |
| 231 | return false; |
| 232 | |
| 233 | case ProcessRunner::Error: // fall-through |
| 234 | default: |
| 235 | return false; |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | void OrganizerProxy::refresh(bool saveChanges) |
| 240 | { |
nothing calls this directly
no test coverage detected