forked from qt-creator/qt-creator
Terminal: Fix exit reporting in error cases
Previously the finished signal was sent not sent soon enough for the Process to recognizes it correctly. Also, the process stub would exit prematurely in cases of crashes. The process stub should only return an error exit code if it did not show the "waiting for keypress" message. Fixes: QTCREATORBUG-29350 Change-Id: I86f7d75bacbdb5ee2b0009669926d94b6a75346a Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -280,8 +280,10 @@ void TerminalInterface::sendCommand(char c)
|
|||||||
void TerminalInterface::killInferiorProcess()
|
void TerminalInterface::killInferiorProcess()
|
||||||
{
|
{
|
||||||
sendCommand('k');
|
sendCommand('k');
|
||||||
if (d->stubSocket)
|
if (d->stubSocket) {
|
||||||
d->stubSocket->waitForReadyRead();
|
d->stubSocket->waitForReadyRead();
|
||||||
|
emitFinished(-1, QProcess::CrashExit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TerminalInterface::killStubProcess()
|
void TerminalInterface::killStubProcess()
|
||||||
|
@@ -185,7 +185,7 @@ void doExit(int exitCode)
|
|||||||
std::cout << commandLineParser.value("wait").toStdString() << std::endl;
|
std::cout << commandLineParser.value("wait").toStdString() << std::endl;
|
||||||
|
|
||||||
waitingForExitKeyPress = true;
|
waitingForExitKeyPress = true;
|
||||||
onKeyPress([exitCode] { doExit(exitCode); });
|
onKeyPress([] { doExit(0); });
|
||||||
} else {
|
} else {
|
||||||
exit(exitCode);
|
exit(exitCode);
|
||||||
}
|
}
|
||||||
@@ -206,9 +206,7 @@ void onInferiorFinished(int exitCode, QProcess::ExitStatus status)
|
|||||||
|
|
||||||
void onInferiorErrorOccurered(QProcess::ProcessError error)
|
void onInferiorErrorOccurered(QProcess::ProcessError error)
|
||||||
{
|
{
|
||||||
qCInfo(log) << "Inferior error: " << error << inferiorProcess.errorString();
|
qCWarning(log) << "Inferior error: " << error << inferiorProcess.errorString();
|
||||||
sendCrash(inferiorProcess.exitCode());
|
|
||||||
doExit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onInferiorStarted()
|
void onInferiorStarted()
|
||||||
|
Reference in New Issue
Block a user