| 101 | } |
| 102 | |
| 103 | void OsShell::executeShellCommand(const QString& command, const QString& workingDir) |
| 104 | { |
| 105 | std::thread([command, workingDir] { |
| 106 | #ifdef _WIN32 |
| 107 | WCHAR commandString[32768] = { 0 }; |
| 108 | const auto len = (QStringLiteral("pushd ") + workingDir + " && " + command).toWCharArray(commandString); |
| 109 | //const auto len = QString{"cmd /c \"%1\""}.arg(command).toWCharArray(commandString); |
| 110 | assert_and_return_r(static_cast<size_t>(len) < std::size(commandString), ); |
| 111 | ::_wsystem(commandString); |
| 112 | #else |
| 113 | const QString commandLine = "cd " % escapedPath(workingDir) % " && " % command; |
| 114 | const int result = std::system(commandLine.toUtf8().constData()); |
| 115 | if (result != 0) |
| 116 | qInfo().noquote() << "The command failed with code " << result << '\n' << commandLine; |
| 117 | #endif |
| 118 | }).detach(); |
| 119 | } |
| 120 | |
| 121 | #ifdef _WIN32 |
| 122 |
nothing calls this directly
no test coverage detected