forked from qt-creator/qt-creator
Utils::Shellcommand: Remove runFullySynchronous
Nobody uses that anymore. Change-Id: I24935ac8d25eb639eb253250749750993c740516 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -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<OutputProxy> 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;
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user