Commit a309c26f authored by Tobias Hunger's avatar Tobias Hunger

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
// determine version as '(major << 16) + (minor << 8) + patch' or 0.
unsigned GitClient::synchronousGitVersion(bool silent, QString *errorMessage) const
{
if (gitBinaryPath().isEmpty())
return 0;
// run git --version
QByteArray outputText;
QByteArray errorText;
......
......@@ -793,6 +793,12 @@ static SynchronousProcessResponse runVcsFullySynchronously(const QString &workin
unsigned flags,
QTextCodec *outputCodec = 0)
{
SynchronousProcessResponse response;
if (binary.isEmpty()) {
response.result = SynchronousProcessResponse::StartFailed;
return response;
}
VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance();
// Set up process
......@@ -809,7 +815,6 @@ static SynchronousProcessResponse runVcsFullySynchronously(const QString &workin
// Start
process->start(binary, arguments, QIODevice::ReadOnly);
process->closeWriteChannel();
SynchronousProcessResponse response;
if (!process->waitForStarted()) {
response.result = SynchronousProcessResponse::StartFailed;
return response;
......@@ -869,6 +874,13 @@ SynchronousProcessResponse VcsBasePlugin::runVcs(const QString &workingDir,
unsigned flags,
QTextCodec *outputCodec)
{
SynchronousProcessResponse response;
if (binary.isEmpty()) {
response.result = SynchronousProcessResponse::StartFailed;
return response;
}
VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance();
if (!(flags & SuppressCommandLogging))
......@@ -901,8 +913,6 @@ SynchronousProcessResponse VcsBasePlugin::runVcs(const QString &workingDir,
VcsBase::VcsBasePlugin::setProcessEnvironment(&env, (flags & ForceCLocale));
SynchronousProcessResponse response;
if (flags & FullySynchronously) {
response = runVcsFullySynchronously(workingDir, binary, arguments, timeOutMS,
env, flags, outputCodec);
......@@ -964,6 +974,9 @@ bool VcsBasePlugin::runFullySynchronous(const QString &workingDirectory,
int timeoutMS,
bool logCommandToWindow)
{
if (binary.isEmpty())
return false;
VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance();
if (logCommandToWindow)
......
Markdown is supported
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