forked from qt-creator/qt-creator
VCS: Never try to run empty binaries
Never try to run empty binaries. Task-number: QTCREATORBUG-6849 Change-Id: I591fdb9d39394fc8097908f5934a1a96518859cb Reviewed-by: Hugues Delorme <delorme.hugues@fougsys.fr>
This commit is contained in:
@@ -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
|
|||||||
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
|
|||||||
// 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,
|
|||||||
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,
|
|||||||
|
|
||||||
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,
|
|||||||
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user