forked from qt-creator/qt-creator
Vcs: Get rid of second implementation to run commands fully synchronously
Change-Id: I996e4292a751f6570e3e645bfcabf00f8a168a59 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -375,36 +375,12 @@ bool VcsBaseClient::vcsFullySynchronousExec(const QString &workingDir,
|
|||||||
const QStringList &args,
|
const QStringList &args,
|
||||||
QByteArray *output) const
|
QByteArray *output) const
|
||||||
{
|
{
|
||||||
QProcess vcsProcess;
|
QByteArray errorData;
|
||||||
if (!workingDir.isEmpty())
|
QScopedPointer<VcsCommand> command = createCommand(workingDir);
|
||||||
vcsProcess.setWorkingDirectory(workingDir);
|
bool result = command->runFullySynchronous(args, vcsTimeoutS(), output, &errorData);
|
||||||
vcsProcess.setProcessEnvironment(processEnvironment());
|
if (!errorData.isEmpty())
|
||||||
|
VcsOutputWindow::appendError(QString::fromLocal8Bit(errorData));
|
||||||
VcsOutputWindow::appendCommand(workingDir, vcsBinary(), args);
|
return result;
|
||||||
|
|
||||||
const Utils::FileName binary = vcsBinary();
|
|
||||||
vcsProcess.start(binary.toString(), args);
|
|
||||||
|
|
||||||
if (!vcsProcess.waitForStarted()) {
|
|
||||||
VcsOutputWindow::appendError(tr("Unable to start process \"%1\": %2")
|
|
||||||
.arg(binary.toUserOutput(), vcsProcess.errorString()));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
vcsProcess.closeWriteChannel();
|
|
||||||
|
|
||||||
QByteArray stdErr;
|
|
||||||
if (!Utils::SynchronousProcess::readDataFromProcess(vcsProcess, vcsTimeoutS() * 1000,
|
|
||||||
output, &stdErr, true)) {
|
|
||||||
Utils::SynchronousProcess::stopProcess(vcsProcess);
|
|
||||||
VcsOutputWindow::appendError(tr("Timed out after %1s waiting for the process %2 to finish.")
|
|
||||||
.arg(vcsTimeoutS()).arg(binary.toUserOutput()));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!stdErr.isEmpty())
|
|
||||||
VcsOutputWindow::appendError(QString::fromLocal8Bit(stdErr));
|
|
||||||
|
|
||||||
return vcsProcess.exitStatus() == QProcess::NormalExit && vcsProcess.exitCode() == 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::SynchronousProcessResponse VcsBaseClient::vcsSynchronousExec(const QString &workingDirectory,
|
Utils::SynchronousProcessResponse VcsBaseClient::vcsSynchronousExec(const QString &workingDirectory,
|
||||||
|
Reference in New Issue
Block a user