MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / PerformAction

Method PerformAction

plugins/base/macro-action-run.cpp:15–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13 "AdvSceneSwitcher.action.run"});
14
15bool MacroActionRun::PerformAction()
16{
17 if (_wait) {
18 // Snapshot config before releasing the lock for the blocking wait
19 auto procConfig = _procConfig;
20 const auto timeout = _timeout.Milliseconds();
21 {
22 SuspendLock suspendLock(*this);
23 procConfig.StartProcessAndWait(timeout);
24 }
25 SetTempVarValue("process.id", procConfig.GetProcessId());
26 SetTempVarValue("process.exitCode",
27 procConfig.GetProcessExitCode());
28 SetTempVarValue("process.stream.output",
29 procConfig.GetProcessOutputStream());
30 SetTempVarValue("process.stream.error",
31 procConfig.GetProcessErrorStream());
32 return true;
33 }
34
35 bool procStarted = _procConfig.StartProcessDetached();
36
37 // Fall back to using default application to open given file
38 if (!procStarted && _procConfig.Args().empty()) {
39 vblog(LOG_INFO, "run \"%s\" using QDesktopServices",
40 _procConfig.Path().c_str());
41 QDesktopServices::openUrl(QUrl::fromLocalFile(
42 QString::fromStdString(_procConfig.Path())));
43 }
44
45 return true;
46}
47
48void MacroActionRun::LogAction() const
49{

Callers

nothing calls this directly

Calls 12

SetTempVarValueFunction · 0.85
MillisecondsMethod · 0.80
StartProcessAndWaitMethod · 0.80
GetProcessIdMethod · 0.80
GetProcessExitCodeMethod · 0.80
GetProcessErrorStreamMethod · 0.80
StartProcessDetachedMethod · 0.80
PathMethod · 0.80
emptyMethod · 0.45
ArgsMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected