Commit a309c26f authored by Tobias Hunger's avatar Tobias Hunger
Browse files

VCS: Never try to run empty binaries



Never try to run empty binaries.

Task-number: QTCREATORBUG-6849
Change-Id: I591fdb9d39394fc8097908f5934a1a96518859cb
Reviewed-by: default avatarHugues Delorme <delorme.hugues@fougsys.fr>
parent 1fe85174
...@@ -2329,6 +2329,9 @@ QString GitClient::gitVersionString(bool silent, QString *errorMessage) const ...@@ -2329,6 +2329,9 @@ QString GitClient::gitVersionString(bool silent, QString *errorMessage) const
// determine version as '(major << 16) + (minor << 8) + patch' or 0. // determine version as '(major << 16) + (minor << 8) + patch' or 0.
unsigned GitClient::synchronousGitVersion(bool silent, QString *errorMessage) const unsigned GitClient::synchronousGitVersion(bool silent, QString *errorMessage) const
{ {
if (gitBinaryPath().isEmpty())
return 0;
// run git --version // run git --version
QByteArray outputText; QByteArray outputText;
QByteArray errorText; QByteArray errorText;
......
...@@ -793,6 +793,12 @@ static SynchronousProcessResponse runVcsFullySynchronously(const QString &workin ...@@ -793,6 +793,12 @@ static SynchronousProcessResponse runVcsFullySynchronously(const QString &workin
unsigned flags, unsigned flags,
QTextCodec *outputCodec = 0) QTextCodec *outputCodec = 0)
{ {
SynchronousProcessResponse response;
if (binary.isEmpty()) {
response.result = SynchronousProcessResponse::StartFailed;
return response;
}
VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance(); VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance();
// Set up process // Set up process
...@@ -809,7 +815,6 @@ static SynchronousProcessResponse runVcsFullySynchronously(const QString &workin ...@@ -809,7 +815,6 @@ static SynchronousProcessResponse runVcsFullySynchronously(const QString &workin
// Start // Start
process->start(binary, arguments, QIODevice::ReadOnly); process->start(binary, arguments, QIODevice::ReadOnly);
process->closeWriteChannel(); process->closeWriteChannel();
SynchronousProcessResponse response;
if (!process->waitForStarted()) { if (!process->waitForStarted()) {
response.result = SynchronousProcessResponse::StartFailed; response.result = SynchronousProcessResponse::StartFailed;
return response; return response;
...@@ -869,6 +874,13 @@ SynchronousProcessResponse VcsBasePlugin::runVcs(const QString &workingDir, ...@@ -869,6 +874,13 @@ SynchronousProcessResponse VcsBasePlugin::runVcs(const QString &workingDir,
unsigned flags, unsigned flags,
QTextCodec *outputCodec) QTextCodec *outputCodec)
{ {
SynchronousProcessResponse response;
if (binary.isEmpty()) {
response.result = SynchronousProcessResponse::StartFailed;
return response;
}
VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance(); VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance();
if (!(flags & SuppressCommandLogging)) if (!(flags & SuppressCommandLogging))
...@@ -901,8 +913,6 @@ SynchronousProcessResponse VcsBasePlugin::runVcs(const QString &workingDir, ...@@ -901,8 +913,6 @@ SynchronousProcessResponse VcsBasePlugin::runVcs(const QString &workingDir,
VcsBase::VcsBasePlugin::setProcessEnvironment(&env, (flags & ForceCLocale)); VcsBase::VcsBasePlugin::setProcessEnvironment(&env, (flags & ForceCLocale));
SynchronousProcessResponse response;
if (flags & FullySynchronously) { if (flags & FullySynchronously) {
response = runVcsFullySynchronously(workingDir, binary, arguments, timeOutMS, response = runVcsFullySynchronously(workingDir, binary, arguments, timeOutMS,
env, flags, outputCodec); env, flags, outputCodec);
...@@ -964,6 +974,9 @@ bool VcsBasePlugin::runFullySynchronous(const QString &workingDirectory, ...@@ -964,6 +974,9 @@ bool VcsBasePlugin::runFullySynchronous(const QString &workingDirectory,
int timeoutMS, int timeoutMS,
bool logCommandToWindow) bool logCommandToWindow)
{ {
if (binary.isEmpty())
return false;
VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance(); VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance();
if (logCommandToWindow) if (logCommandToWindow)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment