diff options
author | Tobias Hunger <[email protected]> | 2015-04-10 15:10:36 +0200 |
---|---|---|
committer | Tobias Hunger <[email protected]> | 2015-04-13 10:47:36 +0000 |
commit | 60f5372b6793f33a711b60113087910136d21b14 (patch) | |
tree | 3c5df13038891b847e4541ea29a1fec06d0f92e6 /src/plugins/vcsbase/vcsbaseclient.cpp | |
parent | 7719fb669cc522e2b1846b05e22fb1d0a6317963 (diff) |
Vcs: Get rid of second implementation to run commands fully synchronously
Change-Id: I996e4292a751f6570e3e645bfcabf00f8a168a59
Reviewed-by: Tobias Hunger <[email protected]>
Diffstat (limited to 'src/plugins/vcsbase/vcsbaseclient.cpp')
-rw-r--r-- | src/plugins/vcsbase/vcsbaseclient.cpp | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index 2120adf094d..277e264f2ea 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -375,36 +375,12 @@ bool VcsBaseClient::vcsFullySynchronousExec(const QString &workingDir, const QStringList &args, QByteArray *output) const { - QProcess vcsProcess; - if (!workingDir.isEmpty()) - vcsProcess.setWorkingDirectory(workingDir); - vcsProcess.setProcessEnvironment(processEnvironment()); - - VcsOutputWindow::appendCommand(workingDir, vcsBinary(), args); - - 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; + QByteArray errorData; + QScopedPointer<VcsCommand> command = createCommand(workingDir); + bool result = command->runFullySynchronous(args, vcsTimeoutS(), output, &errorData); + if (!errorData.isEmpty()) + VcsOutputWindow::appendError(QString::fromLocal8Bit(errorData)); + return result; } Utils::SynchronousProcessResponse VcsBaseClient::vcsSynchronousExec(const QString &workingDirectory, |