Utils: Add CommandLine convenience constructors

... taking a QString for the executable.

This weakens the very explicit QString -> FileName conversion via the
named constructors for the special case of constructing a CommandLine.

I think that's worthwhile here, as it reduces the noise on the caller
site under circumstance where the nature of the thing is obvious.

Change-Id: I27b4a73639728893d053b2e7ba65cb745f0ffe83
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-07-23 10:17:57 +02:00
parent 80716610c5
commit 8b72e92167
31 changed files with 55 additions and 53 deletions

View File

@@ -243,7 +243,7 @@ int GerritServer::testConnection()
static GitClient *const client = GitPlugin::client();
const QStringList arguments = curlArguments() << (url(RestUrl) + accountUrlC);
const SynchronousProcessResponse resp = client->vcsFullySynchronousExec(
QString(), {FilePath::fromString(curlBinary), arguments},
QString(), {curlBinary, arguments},
Core::ShellCommand::NoOutput);
if (resp.result == SynchronousProcessResponse::Finished) {
QString output = resp.stdOut();
@@ -345,7 +345,7 @@ void GerritServer::resolveVersion(const GerritParameters &p, bool forceReload)
arguments << p.portFlag << QString::number(port);
arguments << hostArgument() << "gerrit" << "version";
const SynchronousProcessResponse resp = client->vcsFullySynchronousExec(
QString(), {FilePath::fromString(p.ssh), arguments},
QString(), {p.ssh, arguments},
Core::ShellCommand::NoOutput);
QString stdOut = resp.stdOut().trimmed();
stdOut.remove("gerrit version ");
@@ -353,7 +353,7 @@ void GerritServer::resolveVersion(const GerritParameters &p, bool forceReload)
} else {
const QStringList arguments = curlArguments() << (url(RestUrl) + versionUrlC);
const SynchronousProcessResponse resp = client->vcsFullySynchronousExec(
QString(), {FilePath::fromString(curlBinary), arguments},
QString(), {curlBinary, arguments},
Core::ShellCommand::NoOutput);
// REST endpoint for version is only available from 2.8 and up. Do not consider invalid
// if it fails.