| 13 | "AdvSceneSwitcher.action.run"}); |
| 14 | |
| 15 | bool 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 | |
| 48 | void MacroActionRun::LogAction() const |
| 49 | { |
nothing calls this directly
no test coverage detected