diff --git a/src/libs/utils/shellcommand.cpp b/src/libs/utils/shellcommand.cpp index 219f3993338..6568ed656e3 100644 --- a/src/libs/utils/shellcommand.cpp +++ b/src/libs/utils/shellcommand.cpp @@ -209,8 +209,7 @@ void ShellCommand::execute() QFuture task = runAsync(&ShellCommand::run, this); d->m_watcher.setFuture(task); - if (!(d->m_flags & SuppressCommandLogging)) - addTask(task); + emit executedAsync(task); } void ShellCommand::abort() @@ -224,11 +223,6 @@ void ShellCommand::cancel() emit terminate(); } -void ShellCommand::addTask(QFuture &future) -{ - Q_UNUSED(future) -} - void ShellCommand::postRunCommand(const FilePath &workingDirectory) { Q_UNUSED(workingDirectory) diff --git a/src/libs/utils/shellcommand.h b/src/libs/utils/shellcommand.h index 17630ad69fe..11913fe272d 100644 --- a/src/libs/utils/shellcommand.h +++ b/src/libs/utils/shellcommand.h @@ -148,13 +148,14 @@ signals: void appendCommand(const FilePath &workingDirectory, const CommandLine &command); void appendMessage(const QString &text); + void executedAsync(const QFuture &future); + protected: void setEnvironment(const Environment &env); void setDisableUnixTerminal(); int timeoutS() const; private: - virtual void addTask(QFuture &future); virtual void postRunCommand(const Utils::FilePath &workDirectory); FilePath workDirectory(const FilePath &wd) const; void run(QFutureInterface &future); diff --git a/src/plugins/vcsbase/vcscommand.cpp b/src/plugins/vcsbase/vcscommand.cpp index dfe6cbabb88..00e92d89582 100644 --- a/src/plugins/vcsbase/vcscommand.cpp +++ b/src/plugins/vcsbase/vcscommand.cpp @@ -77,10 +77,15 @@ VcsCommand::VcsCommand(const FilePath &workingDirectory, const Environment &envi connect(this, &ShellCommand::appendError, outputWindow, &VcsOutputWindow::appendError); connect(this, &ShellCommand::appendCommand, outputWindow, &VcsOutputWindow::appendCommand); connect(this, &ShellCommand::appendMessage, outputWindow, &VcsOutputWindow::appendMessage); + + connect(this, &ShellCommand::executedAsync, this, &VcsCommand::addTask); } -void VcsCommand::addTask(QFuture &future) +void VcsCommand::addTask(const QFuture &future) { + if ((flags() & SuppressCommandLogging)) + return; + const QString name = displayName(); const auto id = Id::fromString(name + QLatin1String(".action")); if (hasProgressParser()) { diff --git a/src/plugins/vcsbase/vcscommand.h b/src/plugins/vcsbase/vcscommand.h index 460462c3111..86239965614 100644 --- a/src/plugins/vcsbase/vcscommand.h +++ b/src/plugins/vcsbase/vcscommand.h @@ -40,7 +40,7 @@ private: VcsCommand(const Utils::FilePath &defaultWorkingDirectory, const Utils::Environment &environment); - void addTask(QFuture &future) override; + void addTask(const QFuture &future); void postRunCommand(const Utils::FilePath &workDirectory) override; QPointer m_progress;