annotate ui/installwrapper.cpp @ 364:dc4efb0a70cb

Add Linux support
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 14 Apr 2014 16:58:20 +0000
parents f23e0ccd5d14
children 72487438a180
rev   line source
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
1 #include "installwrapper.h"
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
2
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
3 #include <QFileInfo>
364
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
4 #include <QProcess>
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
5 #include <QTemporaryFile>
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
6 #include <QApplication>
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
7 #include <QDir>
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
8 #include <QDebug>
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
9
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
10 #include "logging.h"
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
11
285
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
12 #define INSTALL_TIMEOUT 3600000 /* Wait up to an hour */
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
13
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
14 InstallWrapper::InstallWrapper(QObject* parent,
364
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
15 const QString& path, const QStringList& choices):
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
16 QThread(parent),
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
17 mCertListFile(path),
364
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
18 mChoices(choices)
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
19 {
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
20 }
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
21
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
22 QFileInfo getCinstProcInfo() {
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
23 QFileInfo fi(QCoreApplication::applicationFilePath());
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
24 QDir myDir = fi.absoluteDir();
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
25 QString instProcName = "cinst";
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
26 if (!fi.suffix().isEmpty()) {
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
27 instProcName += "." + fi.suffix();
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
28 }
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
29 return QFileInfo(myDir.absoluteFilePath(instProcName));
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
30 }
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
31
364
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
32 bool InstallWrapper::writeChoices(QTemporaryFile* choicesFile) const
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
33 {
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
34 if (!choicesFile->open()) {
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
35 return false;
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
36 }
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
37
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
38 foreach (const QString &b64data, mChoices) {
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
39 if (!choicesFile->write(b64data.toLatin1())) {
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
40 return false;
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
41 }
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
42 if (!choicesFile->write("\n")) {
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
43 return false;
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
44 }
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
45 }
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
46
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
47 choicesFile->close();
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
48
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
49 return true;
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
50 }
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
51
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
52 void InstallWrapper::run()
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
53 {
285
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
54 /* TODO: We need errorcodes here so that we can see if a user
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
55 * cancled the UAC elevation */
364
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
56 QTemporaryFile choicesFile;
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
57 QFileInfo cinstProcInfo = getCinstProcInfo();
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
58
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
59 QString cinstFileName = QDir::toNativeSeparators(
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
60 getCinstProcInfo().absoluteFilePath());
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
61
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
62 if (!cinstProcInfo.isExecutable()) {
285
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
63 emit error(tr("Could not find certificate installation process."));
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
64 return;
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
65 }
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
66
364
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
67 if (!writeChoices(&choicesFile)) {
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
68 emit error(tr("Failed to write temporary file."));
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
69 return;
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
70 }
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
71
364
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
72 QString parameters = "\"list=" + mCertListFile +
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
73 "\" \"choices=" + choicesFile.fileName() + "\"";
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
74
364
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
75 #ifdef WIN32
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
76 /* QProcess on Windows uses CreateProcess but we have to
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
77 * use the runas shell command to get the UAC prompt if necessary.
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
78 * So we have to handle the process ourself. Starting with
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
79 * shell execute also means that we can not have stdout and stderr
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
80 * redirection. This is the reason we use command line parameters
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
81 * and not a pipe for communication. In debug mode the installer
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
82 * also makes use of output debug string. */
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
83 DWORD retval = 0;
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
84 SHELLEXECUTEINFOW shExecInfo;
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
85
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
86 memset (&shExecInfo, 0, sizeof(SHELLEXECUTEINFOW));
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
87
285
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
88 shExecInfo.cbSize = sizeof(SHELLEXECUTEINFOW);
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
89 shExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
90 shExecInfo.lpVerb = L"runas";
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
91 shExecInfo.lpFile = reinterpret_cast<LPCWSTR> (cinstFileName.utf16());
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
92 shExecInfo.lpParameters = reinterpret_cast<LPCWSTR> (parameters.utf16());
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
93
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
94 qDebug() << "Starting process " << cinstFileName <<" params: " << parameters;
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
95
285
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
96 if (!ShellExecuteExW(&shExecInfo)) {
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
97 char* errmsg = getLastErrorMsg();
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
98 QString qerrmsg = QString::fromUtf8(errmsg);
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
99 free(errmsg);
285
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
100 emit error(tr("Error executing process: %1").arg(qerrmsg));
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
101 return;
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
102 }
285
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
103
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
104 retval = WaitForSingleObject(shExecInfo.hProcess, INSTALL_TIMEOUT);
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
105
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
106 if (retval != WAIT_OBJECT_0) {
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
107 if (retval == WAIT_FAILED) {
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
108 char* errmsg = getLastErrorMsg();
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
109 QString qerrmsg = QString::fromUtf8(errmsg);
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
110 free(errmsg);
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
111 emit error (tr("Error monitoring process: %1").arg(qerrmsg));
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
112 return;
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
113 } else {
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
114 emit error (tr("Certificate installation timed out."));
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
115 return;
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
116 }
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
117 }
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
118
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
119 if (GetExitCodeProcess(shExecInfo.hProcess, &retval)) {
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
120 if (retval == STILL_ACTIVE) {
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
121 qDebug() << "Process still running, huh..";
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
122 }
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
123 } else {
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
124 char* errmsg = getLastErrorMsg();
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
125 QString qerrmsg = QString::fromUtf8(errmsg);
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
126 free(errmsg);
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
127 emit error (tr("Failed to check process status: %1").arg(qerrmsg));
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
128 }
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
129 CloseHandle(shExecInfo.hProcess);
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
130
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
131 if (retval != 0) {
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
132 /* TODO make this nicer */
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
133 emit error (tr("The process failed with return code. %1").arg(retval));
f23e0ccd5d14 Fix call to windows process.
Andre Heinecke <aheinecke@intevation.de>
parents: 256
diff changeset
134 }
364
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
135 return;
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
136 #else /* WIN32 */
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
137 QProcess installerProcess;
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
138 installerProcess.setProgram(cinstProcInfo.absoluteFilePath());
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
139 installerProcess.waitForStarted();
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
140 if (installerProcess.state() == QProcess::NotRunning) {
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
141 emit error (tr("Failed to start installer process."));
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
142 return;
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
143 }
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
144
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
145 installerProcess.waitForFinished();
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
146
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
147 if (installerProcess.exitStatus() == QProcess::CrashExit) {
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
148 /* Woops */
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
149 qWarning() << "Installer process crashed";
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
150 } else if (installerProcess.exitStatus() != QProcess::NormalExit) {
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
151 /* Can not Happen. there are only those two values but maybe
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
152 * qt changed.. */
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
153 qWarning() << "Exit status neither normal nor crash.";
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
154 return;
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
155 }
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
156
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
157 if (installerProcess.exitCode() == 0) {
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
158 qDebug() << "output: " << installerProcess.readAllStandardOutput();
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
159 } else {
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
160 /* TODO handle errors defined by errorcodes.h */
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
161 qDebug() << "Installer Process returned: " << installerProcess.exitCode();
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
162 qDebug() << "output: " << installerProcess.readAllStandardOutput();
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
163 return;
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
164 }
dc4efb0a70cb Add Linux support
Andre Heinecke <aheinecke@intevation.de>
parents: 285
diff changeset
165 #endif
256
84ae353688e0 Add installwrapper class to handle process communication
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
166 }

http://wald.intevation.org/projects/trustbridge/