Git: Use QtcProcess in GitClient

Change-Id: Ia92d803ea8f647681ab5ffe51fa9a55bd5924df7
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2021-08-20 08:44:58 +02:00
parent dce88c29a7
commit 2adaea866f

View File

@@ -2561,9 +2561,9 @@ void GitClient::launchGitK(const FilePath &workingDirectory, const QString &file
void GitClient::launchRepositoryBrowser(const FilePath &workingDirectory) const void GitClient::launchRepositoryBrowser(const FilePath &workingDirectory) const
{ {
const QString repBrowserBinary = settings().repositoryBrowserCmd.value(); const FilePath repBrowserBinary = settings().repositoryBrowserCmd.filePath();
if (!repBrowserBinary.isEmpty()) if (!repBrowserBinary.isEmpty())
QProcess::startDetached(repBrowserBinary, {workingDirectory.toString()}, workingDirectory.toString()); QtcProcess::startDetached({repBrowserBinary, {workingDirectory.toString()}}, workingDirectory);
} }
bool GitClient::tryLauchingGitK(const Environment &env, bool GitClient::tryLauchingGitK(const Environment &env,
@@ -2591,18 +2591,18 @@ bool GitClient::tryLauchingGitK(const Environment &env,
// the child), but that does not have an environment parameter. // the child), but that does not have an environment parameter.
bool success = false; bool success = false;
if (!settings().path.value().isEmpty()) { if (!settings().path.value().isEmpty()) {
auto process = new QProcess; auto process = new QtcProcess;
process->setWorkingDirectory(workingDirectory.toString()); process->setWorkingDirectory(workingDirectory);
process->setProcessEnvironment(env.toProcessEnvironment()); process->setEnvironment(env);
process->start(binary.toString(), arguments); process->setCommand({binary, arguments});
process->start();
success = process->waitForStarted(); success = process->waitForStarted();
if (success) if (success)
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), connect(process, &QtcProcess::finished, process, &QProcess::deleteLater);
process, &QProcess::deleteLater);
else else
delete process; delete process;
} else { } else {
success = QProcess::startDetached(binary.toString(), arguments, workingDirectory.toString()); success = QtcProcess::startDetached({binary, arguments}, workingDirectory);
} }
return success; return success;