From cc27125092b32a69422aa946dfdbdb66d5d8e428 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Mon, 4 Jul 2016 15:11:50 +0200 Subject: [PATCH] Utils::Shellcommand: Remove runFullySynchronous Nobody uses that anymore. Change-Id: I24935ac8d25eb639eb253250749750993c740516 Reviewed-by: Tobias Hunger --- src/libs/utils/shellcommand.cpp | 37 ------------------------------ src/libs/utils/shellcommand.h | 7 +----- src/plugins/vcsbase/vcscommand.cpp | 10 -------- src/plugins/vcsbase/vcscommand.h | 3 --- 4 files changed, 1 insertion(+), 56 deletions(-) diff --git a/src/libs/utils/shellcommand.cpp b/src/libs/utils/shellcommand.cpp index dfb58e17ff2..cb2ce489fc9 100644 --- a/src/libs/utils/shellcommand.cpp +++ b/src/libs/utils/shellcommand.cpp @@ -455,43 +455,6 @@ Utils::SynchronousProcessResponse ShellCommand::runSynchronous(const Utils::File return response; } -bool ShellCommand::runFullySynchronous(const Utils::FileName &binary, const QStringList &arguments, - int timeoutS, QByteArray *outputData, QByteArray *errorData, - const QString &workingDirectory) -{ - QTC_ASSERT(!binary.isEmpty(), return false); - - QScopedPointer proxy(d->m_proxyFactory()); - const QString dir = workDirectory(workingDirectory); - - if (!(d->m_flags & SuppressCommandLogging)) - proxy->appendCommand(dir, binary, arguments); - - QProcess process; - process.setWorkingDirectory(dir); - process.setProcessEnvironment(d->m_environment); - - process.start(binary.toString(), arguments); - process.closeWriteChannel(); - if (!process.waitForStarted()) { - if (errorData) { - const QString msg = QString::fromLatin1("Unable to execute \"%1\": %2:") - .arg(binary.toUserOutput(), process.errorString()); - *errorData = msg.toLocal8Bit(); - } - return false; - } - - if (!Utils::SynchronousProcess::readDataFromProcess(process, timeoutS, outputData, errorData, true)) { - if (errorData) - errorData->append(tr("Error: Executable timed out after %1 s.").arg(timeoutS).toLocal8Bit()); - Utils::SynchronousProcess::stopProcess(process); - return false; - } - - return process.exitStatus() == QProcess::NormalExit && process.exitCode() == 0; -} - const QVariant &ShellCommand::cookie() const { return d->m_cookie; diff --git a/src/libs/utils/shellcommand.h b/src/libs/utils/shellcommand.h index 62949b8c63b..4511611b869 100644 --- a/src/libs/utils/shellcommand.h +++ b/src/libs/utils/shellcommand.h @@ -115,7 +115,7 @@ public: const QString &workingDirectory = QString(), const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter); void addJob(const FileName &binary, const QStringList &arguments, int timeoutS, const QString &workingDirectory = QString(), const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter); - void execute(); + void execute(); // Execute tasks asynchronously! void abort(); bool lastExecutionSuccess() const; int lastExecutionExitCode() const; @@ -144,12 +144,7 @@ public: int timeoutS, const QString &workingDirectory = QString(), const ExitCodeInterpreter &interpreter = defaultExitCodeInterpreter); - // Make sure to not pass through the event loop at all: - virtual bool runFullySynchronous(const FileName &binary, const QStringList &arguments, - int timeoutS, QByteArray *outputData, QByteArray *errorData, - const QString &workingDirectory = QString()); -public slots: void cancel(); signals: diff --git a/src/plugins/vcsbase/vcscommand.cpp b/src/plugins/vcsbase/vcscommand.cpp index 2062ab6c8d3..14d03e3a699 100644 --- a/src/plugins/vcsbase/vcscommand.cpp +++ b/src/plugins/vcsbase/vcscommand.cpp @@ -82,16 +82,6 @@ Utils::SynchronousProcessResponse VcsCommand::runCommand(const Utils::FileName & return response; } -bool VcsCommand::runFullySynchronous(const Utils::FileName &binary, const QStringList &arguments, - int timeoutS, QByteArray *outputData, QByteArray *errorData, - const QString &workingDirectory) -{ - bool result = Core::ShellCommand::runFullySynchronous(binary, arguments, timeoutS, - outputData, errorData, workingDirectory); - emitRepositoryChanged(workingDirectory); - return result; -} - void VcsCommand::emitRepositoryChanged(const QString &workingDirectory) { if (m_preventRepositoryChanged || !(flags() & VcsCommand::ExpectRepoChanges)) diff --git a/src/plugins/vcsbase/vcscommand.h b/src/plugins/vcsbase/vcscommand.h index af9d1214d68..bc7ad022e43 100644 --- a/src/plugins/vcsbase/vcscommand.h +++ b/src/plugins/vcsbase/vcscommand.h @@ -50,9 +50,6 @@ public: const QString &workDirectory = QString(), const Utils::ExitCodeInterpreter &interpreter = Utils::defaultExitCodeInterpreter) override; - bool runFullySynchronous(const Utils::FileName &binary, const QStringList &arguments, - int timeoutS, QByteArray *outputData, QByteArray *errorData, - const QString &workingDirectory = QString()) override; private: unsigned processFlags() const override; void emitRepositoryChanged(const QString &workingDirectory);