forked from qt-creator/qt-creator
ShellCommand: Remove exitCode arg from finished() signal
The only 2 handlers were taking it into account and they interpreted the non-zero exit code as a failure, so basically they repeated the work of default exitCodeInterpreter. Change-Id: I9848ef0cf5ca9017f02a02ae59dc09ec426f7626 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -257,7 +257,6 @@ void ShellCommand::run(QFutureInterface<void> &future)
|
|||||||
else
|
else
|
||||||
future.setProgressRange(0, 1);
|
future.setProgressRange(0, 1);
|
||||||
const int count = d->m_jobs.size();
|
const int count = d->m_jobs.size();
|
||||||
int lastExecExitCode = -1;
|
|
||||||
bool lastExecSuccess = true;
|
bool lastExecSuccess = true;
|
||||||
for (int j = 0; j < count; j++) {
|
for (int j = 0; j < count; j++) {
|
||||||
const Internal::ShellCommandPrivate::Job &job = d->m_jobs.at(j);
|
const Internal::ShellCommandPrivate::Job &job = d->m_jobs.at(j);
|
||||||
@@ -267,7 +266,6 @@ void ShellCommand::run(QFutureInterface<void> &future)
|
|||||||
runCommand(proc, job.command, job.workingDirectory);
|
runCommand(proc, job.command, job.workingDirectory);
|
||||||
stdOut += proc.cleanedStdOut();
|
stdOut += proc.cleanedStdOut();
|
||||||
stdErr += proc.cleanedStdErr();
|
stdErr += proc.cleanedStdErr();
|
||||||
lastExecExitCode = proc.exitCode();
|
|
||||||
lastExecSuccess = proc.result() == ProcessResult::FinishedWithSuccess;
|
lastExecSuccess = proc.result() == ProcessResult::FinishedWithSuccess;
|
||||||
if (!lastExecSuccess)
|
if (!lastExecSuccess)
|
||||||
break;
|
break;
|
||||||
@@ -280,7 +278,7 @@ void ShellCommand::run(QFutureInterface<void> &future)
|
|||||||
emit stdErrText(stdErr);
|
emit stdErrText(stdErr);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit finished(lastExecSuccess, lastExecExitCode, cookie());
|
emit finished(lastExecSuccess, cookie());
|
||||||
if (lastExecSuccess) {
|
if (lastExecSuccess) {
|
||||||
emit success(cookie());
|
emit success(cookie());
|
||||||
future.setProgressValue(future.progressMaximum());
|
future.setProgressValue(future.progressMaximum());
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ signals:
|
|||||||
void stdOutText(const QString &);
|
void stdOutText(const QString &);
|
||||||
void stdErrText(const QString &);
|
void stdErrText(const QString &);
|
||||||
void started();
|
void started();
|
||||||
void finished(bool ok, int exitCode, const QVariant &cookie);
|
void finished(bool success, const QVariant &cookie);
|
||||||
void success(const QVariant &cookie);
|
void success(const QVariant &cookie);
|
||||||
|
|
||||||
void terminate(); // Internal
|
void terminate(); // Internal
|
||||||
|
|||||||
@@ -103,11 +103,10 @@ void ShellCommandPage::start(ShellCommand *command)
|
|||||||
wizard()->button(QWizard::BackButton)->setEnabled(false);
|
wizard()->button(QWizard::BackButton)->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShellCommandPage::slotFinished(bool ok, int exitCode, const QVariant &)
|
void ShellCommandPage::slotFinished(bool success, const QVariant &)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_state == Running, return);
|
QTC_ASSERT(m_state == Running, return);
|
||||||
|
|
||||||
const bool success = (ok && exitCode == 0);
|
|
||||||
QString message;
|
QString message;
|
||||||
QPalette palette;
|
QPalette palette;
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ signals:
|
|||||||
void finished(bool success);
|
void finished(bool success);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void slotFinished(bool ok, int exitCode, const QVariant &cookie);
|
void slotFinished(bool success, const QVariant &cookie);
|
||||||
|
|
||||||
QPlainTextEdit *m_logPlainTextEdit;
|
QPlainTextEdit *m_logPlainTextEdit;
|
||||||
OutputFormatter *m_formatter;
|
OutputFormatter *m_formatter;
|
||||||
|
|||||||
@@ -194,9 +194,8 @@ static Utils::FilePaths scanDirectoryForFiles(const Utils::FilePath &directory)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitLabCloneDialog::cloneFinished(bool ok, int exitCode)
|
void GitLabCloneDialog::cloneFinished(bool success)
|
||||||
{
|
{
|
||||||
const bool success = (ok && exitCode == 0);
|
|
||||||
m_commandRunning = false;
|
m_commandRunning = false;
|
||||||
delete m_command;
|
delete m_command;
|
||||||
m_command = nullptr;
|
m_command = nullptr;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ private:
|
|||||||
void updateUi();
|
void updateUi();
|
||||||
void cloneProject();
|
void cloneProject();
|
||||||
void cancel();
|
void cancel();
|
||||||
void cloneFinished(bool ok, int exitCode);
|
void cloneFinished(bool success);
|
||||||
|
|
||||||
QComboBox * m_repositoryCB = nullptr;
|
QComboBox * m_repositoryCB = nullptr;
|
||||||
QCheckBox *m_submodulesCB = nullptr;
|
QCheckBox *m_submodulesCB = nullptr;
|
||||||
|
|||||||
@@ -1232,12 +1232,10 @@ DiffChunk VcsBaseEditorWidget::diffChunk(QTextCursor cursor) const
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VcsBaseEditorWidget::reportCommandFinished(bool ok, int exitCode, const QVariant &data)
|
void VcsBaseEditorWidget::reportCommandFinished(bool success, const QVariant &data)
|
||||||
{
|
{
|
||||||
Q_UNUSED(exitCode)
|
|
||||||
|
|
||||||
hideProgressIndicator();
|
hideProgressIndicator();
|
||||||
if (!ok) {
|
if (!success) {
|
||||||
textDocument()->setPlainText(tr("Failed to retrieve data."));
|
textDocument()->setPlainText(tr("Failed to retrieve data."));
|
||||||
} else if (data.type() == QVariant::Int) {
|
} else if (data.type() == QVariant::Int) {
|
||||||
const int line = data.toInt();
|
const int line = data.toInt();
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ signals:
|
|||||||
void diffChunkReverted(const VcsBase::DiffChunk &dc);
|
void diffChunkReverted(const VcsBase::DiffChunk &dc);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void reportCommandFinished(bool ok, int exitCode, const QVariant &data);
|
void reportCommandFinished(bool success, const QVariant &data);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void contextMenuEvent(QContextMenuEvent *e) override;
|
void contextMenuEvent(QContextMenuEvent *e) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user