@@ -89,41 +89,49 @@ bool ConsumeOutputOperation::performOperation()
89
89
const QStringList processArguments = arguments ().mid (2 );
90
90
// in some cases it is not runable, because another process is blocking it(filewatcher ...)
91
91
int waitCount = 0 ;
92
+ int _exitCode = 0 ;
92
93
while (executableOutput.isEmpty () && waitCount < 3 ) {
93
94
QProcess process;
94
95
process.setProcessChannelMode (QProcess::MergedChannels);
95
96
process.start (executable, processArguments, QIODevice::ReadOnly);
96
97
if (process.waitForFinished (10000 )) {
97
98
if (process.exitStatus () == QProcess::CrashExit) {
98
99
qCWarning (QInstaller::lcInstallerInstallLog) << executable
99
- << processArguments << " crashed with exit code"
100
- << process.exitCode () << " standard output: "
101
- << process.readAllStandardOutput () << " error output: "
102
- << process.readAllStandardError ();
100
+ << processArguments << " crashed with exit code"
101
+ << process.exitCode () << " standard output: "
102
+ << process.readAllStandardOutput () << " error output: "
103
+ << process.readAllStandardError ();
103
104
setError (UserDefinedError);
104
105
setErrorString (tr (" Failed to run command: \" %1\" : %2" ).arg (
105
106
QDir::toNativeSeparators (executable), process.errorString ()));
107
+
108
+ _exitCode = process.exitCode ();
109
+ core->setValue (installerKeyName + QStringLiteral (" ExitCode" ), (const QString)QString::number (_exitCode));
106
110
return false ;
107
111
}
112
+
113
+ _exitCode = process.exitCode ();
108
114
executableOutput.append (process.readAllStandardOutput ());
109
115
}
116
+
110
117
if (executableOutput.isEmpty ()) {
111
118
++waitCount;
112
119
static const int waitTimeInMilliSeconds = 500 ;
113
120
uiDetachedWait (waitTimeInMilliSeconds);
114
121
}
115
122
if (process.state () > QProcess::NotRunning ) {
116
123
qCWarning (QInstaller::lcInstallerInstallLog) << executable
117
- << " process is still running, need to kill it." ;
124
+ << " process is still running, need to kill it." ;
118
125
process.kill ();
119
126
}
120
127
121
128
}
122
129
if (executableOutput.isEmpty ()) {
123
130
qCWarning (QInstaller::lcInstallerInstallLog) << " Cannot get any query output from executable"
124
- << executable;
131
+ << executable;
125
132
}
126
133
core->setValue (installerKeyName, QString::fromLocal8Bit (executableOutput.trimmed ()));
134
+ core->setValue (installerKeyName + QStringLiteral (" ExitCode" ), (const QString)QString::number (_exitCode));
127
135
return true ;
128
136
}
129
137
0 commit comments