forked from qt-creator/qt-creator
Terminal: add finished signal
Change-Id: I9d560d1f1bbaa94ae75420002744073a1e8fad1a Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -151,10 +151,10 @@ void TerminalWidget::setupPty()
|
|||||||
connect(m_process.get(), &Process::done, this, [this] {
|
connect(m_process.get(), &Process::done, this, [this] {
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
|
|
||||||
|
const int exitCode = QTC_GUARD(m_process) ? m_process->exitCode() : -1;
|
||||||
if (m_process) {
|
if (m_process) {
|
||||||
if (m_process->exitCode() != 0) {
|
if (exitCode != 0) {
|
||||||
errorMessage
|
errorMessage = Tr::tr("Terminal process exited with code %1").arg(exitCode);
|
||||||
= Tr::tr("Terminal process exited with code %1").arg(m_process->exitCode());
|
|
||||||
|
|
||||||
if (!m_process->errorString().isEmpty())
|
if (!m_process->errorString().isEmpty())
|
||||||
errorMessage += QString(" (%1)").arg(m_process->errorString());
|
errorMessage += QString(" (%1)").arg(m_process->errorString());
|
||||||
@@ -181,14 +181,14 @@ void TerminalWidget::setupPty()
|
|||||||
|
|
||||||
writeToTerminal(msg, true);
|
writeToTerminal(msg, true);
|
||||||
} else {
|
} else {
|
||||||
QString exitMsg = Tr::tr("Process exited with code: %1")
|
QString exitMsg = Tr::tr("Process exited with code: %1").arg(exitCode);
|
||||||
.arg(m_process ? m_process->exitCode() : -1);
|
|
||||||
QByteArray msg = QString("\r\n%1").arg(exitMsg).toUtf8();
|
QByteArray msg = QString("\r\n%1").arg(exitMsg).toUtf8();
|
||||||
writeToTerminal(msg, true);
|
writeToTerminal(msg, true);
|
||||||
}
|
}
|
||||||
} else if (!errorMessage.isEmpty()) {
|
} else if (!errorMessage.isEmpty()) {
|
||||||
Core::MessageManager::writeFlashing(errorMessage);
|
Core::MessageManager::writeFlashing(errorMessage);
|
||||||
}
|
}
|
||||||
|
emit finised(exitCode);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_process.get(), &Process::started, this, [this] {
|
connect(m_process.get(), &Process::started, this, [this] {
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void started(qint64 pid);
|
void started(qint64 pid);
|
||||||
|
void finised(int exitCode);
|
||||||
void cwdChanged(const Utils::FilePath &cwd);
|
void cwdChanged(const Utils::FilePath &cwd);
|
||||||
void commandChanged(const Utils::CommandLine &cmd);
|
void commandChanged(const Utils::CommandLine &cmd);
|
||||||
void titleChanged();
|
void titleChanged();
|
||||||
|
|||||||
Reference in New Issue
Block a user