MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / waitForApplication

Method waitForApplication

src/organizerproxy.cpp:200–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200bool 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
239void OrganizerProxy::refresh(bool saveChanges)
240{

Callers

nothing calls this directly

Calls 3

processRunnerMethod · 0.80
attachToProcessMethod · 0.80
exitCodeMethod · 0.80

Tested by

no test coverage detected