MCPcopy Create free account
hub / github.com/comaps/comaps / ExecProcess

Function ExecProcess

qt/build_style/build_common.cpp:19–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17#include <string>
18
19QString ExecProcess(QString const & program, std::initializer_list<QString> args, QProcessEnvironment const * env)
20{
21 QStringList qargs(args);
22 QProcess p;
23 if (nullptr != env)
24 p.setProcessEnvironment(*env);
25
26 p.start(program, qargs, QIODevice::ReadOnly);
27 p.waitForFinished(-1);
28
29 int const exitCode = p.exitCode();
30 QString output = p.readAllStandardOutput();
31 QString const error = p.readAllStandardError();
32 if (exitCode != 0)
33 {
34 QString msg = "Error: " + program + " " + qargs.join(" ") + "\nReturned " + QString::number(exitCode);
35 if (!output.isEmpty())
36 msg += "\n" + output;
37 if (!error.isEmpty())
38 msg += "\nSTDERR:\n" + error;
39 throw std::runtime_error(msg.toStdString());
40 }
41 if (!error.isEmpty())
42 {
43 QString msg = "STDERR with a zero exit code:\n" + program + " " + qargs.join(" ");
44 msg += "\nSTDERR:\n" + error;
45 LOG(LINFO, (msg.toStdString()));
46 }
47 return output;
48}
49
50bool CopyFile(QString const & oldFile, QString const & newFile)
51{

Callers 6

BuildSkinImplFunction · 0.85
RunBuildingPhonePackFunction · 0.85
GetStyleStatisticsFunction · 0.85
RunCurrentStyleTestsFunction · 0.85
BuildDrawingRulesImplFunction · 0.85

Calls 3

startMethod · 0.65
joinMethod · 0.45
isEmptyMethod · 0.45

Tested by 1

RunCurrentStyleTestsFunction · 0.68