aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2024-05-16 12:31:24 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2024-05-16 12:45:42 +0000
commit53de9701f45adfd77e6fd39725d3ce5135ce5b3e (patch)
tree276271b9e13c42b52dbfd51a169821b87c4ea8be
parent34f4ec11bd2cf430146340b8a2d4a3db6abe4866 (diff)
CommandLine: Use more 1-arg c'tor
Change-Id: If52c4094f94859d51e31862d913b1756e333e512 Reviewed-by: hjk <hjk@qt.io>
-rw-r--r--src/libs/utils/externalterminalprocessimpl.cpp2
-rw-r--r--src/libs/utils/terminalinterface.cpp2
-rw-r--r--src/plugins/autotest/testrunner.cpp2
-rw-r--r--src/plugins/baremetal/debugservers/gdb/eblinkgdbserverprovider.cpp2
-rw-r--r--src/plugins/baremetal/debugservers/gdb/stlinkutilgdbserverprovider.cpp2
-rw-r--r--src/plugins/boot2qt/qdbdevice.cpp2
-rw-r--r--src/plugins/boot2qt/qdbplugin.cpp2
-rw-r--r--src/plugins/docker/dockerdevice.cpp6
-rw-r--r--src/plugins/git/gitclient.cpp2
-rw-r--r--src/plugins/perfprofiler/perftracepointdialog.cpp2
-rw-r--r--src/plugins/projectexplorer/devicesupport/desktopdevice.cpp4
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp6
-rw-r--r--src/plugins/python/pythonlanguageclient.cpp2
-rw-r--r--src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp4
-rw-r--r--src/plugins/qnx/slog2inforunner.cpp2
-rw-r--r--src/plugins/remotelinux/filesystemaccess_test.cpp2
-rw-r--r--src/plugins/remotelinux/linuxdevice.cpp4
-rw-r--r--src/plugins/terminal/shellmodel.cpp2
-rw-r--r--src/plugins/terminal/terminalpane.cpp2
-rw-r--r--src/plugins/valgrind/valgrindmemcheckparsertest.cpp2
-rw-r--r--tests/auto/utils/deviceshell/tst_deviceshell.cpp8
-rw-r--r--tests/auto/utils/process/processtestapp/processtestapp.cpp2
-rw-r--r--tests/auto/utils/process/tst_process.cpp11
-rw-r--r--tests/manual/deviceshell/tst_deviceshell.cpp24
24 files changed, 47 insertions, 52 deletions
diff --git a/src/libs/utils/externalterminalprocessimpl.cpp b/src/libs/utils/externalterminalprocessimpl.cpp
index 41b7259b8f..10dcfa4d3a 100644
--- a/src/libs/utils/externalterminalprocessimpl.cpp
+++ b/src/libs/utils/externalterminalprocessimpl.cpp
@@ -181,7 +181,7 @@ expected_str<qint64> ProcessStubCreator::startStubProcess(const ProcessSetupData
process->setProcessMode(ProcessMode::Writer);
} else {
QString extraArgsFromOptions = terminal.executeArgs;
- CommandLine cmdLine = {terminal.command, {}};
+ CommandLine cmdLine{terminal.command};
if (!extraArgsFromOptions.isEmpty())
cmdLine.addArgs(extraArgsFromOptions, CommandLine::Raw);
cmdLine.addCommandLineAsArgs(setupData.m_commandLine, CommandLine::Raw);
diff --git a/src/libs/utils/terminalinterface.cpp b/src/libs/utils/terminalinterface.cpp
index 0d5a3be020..0cd7ceb1df 100644
--- a/src/libs/utils/terminalinterface.cpp
+++ b/src/libs/utils/terminalinterface.cpp
@@ -402,7 +402,7 @@ void TerminalInterface::start()
m_setup.m_commandLine.executable().fileName());
if (m_setup.m_runAsRoot && !HostOsInfo::isWindowsHost()) {
- CommandLine rootCommand("sudo", {});
+ CommandLine rootCommand("sudo");
rootCommand.addCommandLineAsArgs(cmd);
stubSetupData.m_commandLine = rootCommand;
} else {
diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp
index fe3fe22fdd..6c8f19c1bb 100644
--- a/src/plugins/autotest/testrunner.cpp
+++ b/src/plugins/autotest/testrunner.cpp
@@ -383,7 +383,7 @@ void TestRunner::runTestsHelper()
connect(testStorage->m_outputReader.get(), &TestOutputReader::newOutputLineAvailable,
TestResultsPane::instance(), &TestResultsPane::addOutputLine);
- CommandLine command{config->testExecutable(), {}};
+ CommandLine command{config->testExecutable()};
if (config->testBase()->type() == ITestBase::Framework) {
TestConfiguration *current = static_cast<TestConfiguration *>(config);
QStringList omitted;
diff --git a/src/plugins/baremetal/debugservers/gdb/eblinkgdbserverprovider.cpp b/src/plugins/baremetal/debugservers/gdb/eblinkgdbserverprovider.cpp
index 7ce65d689e..c31ed27dea 100644
--- a/src/plugins/baremetal/debugservers/gdb/eblinkgdbserverprovider.cpp
+++ b/src/plugins/baremetal/debugservers/gdb/eblinkgdbserverprovider.cpp
@@ -151,7 +151,7 @@ QString EBlinkGdbServerProvider::channelString() const
CommandLine EBlinkGdbServerProvider::command() const
{
- CommandLine cmd{m_executableFile, {}};
+ CommandLine cmd{m_executableFile};
QStringList interFaceTypeStrings = {"swd", "jtag"};
// Obligatorily -I
diff --git a/src/plugins/baremetal/debugservers/gdb/stlinkutilgdbserverprovider.cpp b/src/plugins/baremetal/debugservers/gdb/stlinkutilgdbserverprovider.cpp
index b94012c9dc..96a94dc609 100644
--- a/src/plugins/baremetal/debugservers/gdb/stlinkutilgdbserverprovider.cpp
+++ b/src/plugins/baremetal/debugservers/gdb/stlinkutilgdbserverprovider.cpp
@@ -131,7 +131,7 @@ QString StLinkUtilGdbServerProvider::channelString() const
CommandLine StLinkUtilGdbServerProvider::command() const
{
- CommandLine cmd{m_executableFile, {}};
+ CommandLine cmd{m_executableFile};
if (m_extendedMode)
cmd.addArg("--multi");
diff --git a/src/plugins/boot2qt/qdbdevice.cpp b/src/plugins/boot2qt/qdbdevice.cpp
index 1ede480417..d9cbd3ed2a 100644
--- a/src/plugins/boot2qt/qdbdevice.cpp
+++ b/src/plugins/boot2qt/qdbdevice.cpp
@@ -111,7 +111,7 @@ QdbDevice::QdbDevice()
setType(Constants::QdbLinuxOsType);
addDeviceAction({Tr::tr("Reboot Device"), [](const IDevice::Ptr &device, QWidget *) {
- (void) new DeviceApplicationObserver(device, {device->filePath("reboot"), {}});
+ (void) new DeviceApplicationObserver(device, CommandLine{device->filePath("reboot")});
}});
addDeviceAction({Tr::tr("Restore Default App"), [](const IDevice::Ptr &device, QWidget *) {
diff --git a/src/plugins/boot2qt/qdbplugin.cpp b/src/plugins/boot2qt/qdbplugin.cpp
index c0a5bb25ca..d3943e94b1 100644
--- a/src/plugins/boot2qt/qdbplugin.cpp
+++ b/src/plugins/boot2qt/qdbplugin.cpp
@@ -48,7 +48,7 @@ static void startFlashingWizard()
if (HostOsInfo::isWindowsHost()) {
if (Process::startDetached({"explorer.exe", {filePath.toUserOutput()}}))
return;
- } else if (Process::startDetached({filePath, {}})) {
+ } else if (Process::startDetached(CommandLine{filePath})) {
return;
}
const QString message = Tr::tr("Flash wizard \"%1\" failed to start.");
diff --git a/src/plugins/docker/dockerdevice.cpp b/src/plugins/docker/dockerdevice.cpp
index d225bbf6e6..464a76be98 100644
--- a/src/plugins/docker/dockerdevice.cpp
+++ b/src/plugins/docker/dockerdevice.cpp
@@ -605,7 +605,7 @@ DockerDevice::DockerDevice(std::unique_ptr<DockerDeviceSettings> deviceSettings)
proc.setTerminalMode(TerminalMode::Detached);
proc.setEnvironment(env);
proc.setWorkingDirectory(workingDir);
- proc.setCommand({*shell, {}});
+ proc.setCommand(CommandLine{*shell});
proc.start();
return {};
@@ -1057,13 +1057,13 @@ expected_str<void> DockerDevicePrivate::fetchSystemEnviroment()
QString stdErr;
if (m_shell && m_shell->state() == DeviceShell::State::Succeeded) {
- const RunResult result = runInShell({"env", {}});
+ const RunResult result = runInShell(CommandLine{"env"});
const QString out = QString::fromUtf8(result.stdOut);
m_cachedEnviroment = Environment(out.split('\n', Qt::SkipEmptyParts), q->osType());
stdErr = QString::fromUtf8(result.stdErr);
} else {
Process proc;
- proc.setCommand(withDockerExecCmd({"env", {}}));
+ proc.setCommand(withDockerExecCmd(CommandLine{"env"}));
proc.start();
proc.waitForFinished();
const QString remoteOutput = proc.cleanedStdOut();
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index 9d4d133ee4..16a12f4a42 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -2531,7 +2531,7 @@ bool GitClient::launchGitBash(const FilePath &workingDirectory)
success = false;
} else {
const FilePath gitBash = git.absolutePath().parentDir() / "git-bash.exe";
- success = Process::startDetached({gitBash, {}}, workingDirectory);
+ success = Process::startDetached(CommandLine{gitBash}, workingDirectory);
}
if (!success)
diff --git a/src/plugins/perfprofiler/perftracepointdialog.cpp b/src/plugins/perfprofiler/perftracepointdialog.cpp
index d726aa7d86..66a6208c1e 100644
--- a/src/plugins/perfprofiler/perftracepointdialog.cpp
+++ b/src/plugins/perfprofiler/perftracepointdialog.cpp
@@ -101,7 +101,7 @@ void PerfTracePointDialog::runScript()
if (elevate != QLatin1String(ELEVATE_METHOD_NA))
m_process->setCommand({m_device->filePath(elevate), {"sh"}});
else
- m_process->setCommand({m_device->filePath("sh"), {}});
+ m_process->setCommand(CommandLine{m_device->filePath("sh")});
connect(m_process.get(), &Process::done, this, &PerfTracePointDialog::handleProcessDone);
m_process->start();
diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp
index 2dae1a9b68..b9558f17f1 100644
--- a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp
+++ b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp
@@ -6,7 +6,6 @@
#include "../projectexplorerconstants.h"
#include "../projectexplorertr.h"
#include "desktopprocesssignaloperation.h"
-#include "processlist.h"
#include <coreplugin/fileutils.h>
@@ -21,7 +20,6 @@
#include <utils/url.h>
#include <QCoreApplication>
-#include <QDateTime>
#ifdef Q_OS_WIN
#include <cstring>
@@ -65,7 +63,7 @@ DesktopDevice::DesktopDevice()
Process process;
process.setTerminalMode(TerminalMode::Detached);
process.setEnvironment(realEnv);
- process.setCommand({*shell, {}});
+ process.setCommand(CommandLine{*shell});
process.setWorkingDirectory(path);
process.start();
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index a62ab627be..dd4d686168 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -3616,7 +3616,7 @@ void ProjectExplorerPluginPrivate::openTerminalHere(const EnvironmentGetter &env
}
if (buildDevice->rootPath().needsDevice())
- Terminal::Hooks::instance().openTerminal({CommandLine{*shell, {}}, workingDir, environment});
+ Terminal::Hooks::instance().openTerminal({CommandLine{*shell}, workingDir, environment});
else
Terminal::Hooks::instance().openTerminal({workingDir, environment});
}
@@ -3656,8 +3656,8 @@ void ProjectExplorerPluginPrivate::openTerminalHereWithRunEnv()
}
if (device->rootPath().needsDevice()) {
- Terminal::Hooks::instance().openTerminal(
- {CommandLine{*shell, {}}, workingDir, runnable.environment});
+ Terminal::Hooks::instance().openTerminal({CommandLine{*shell}, workingDir,
+ runnable.environment});
} else {
Terminal::Hooks::instance().openTerminal({workingDir, runnable.environment});
}
diff --git a/src/plugins/python/pythonlanguageclient.cpp b/src/plugins/python/pythonlanguageclient.cpp
index 2379ffb1a1..3c05b8f87e 100644
--- a/src/plugins/python/pythonlanguageclient.cpp
+++ b/src/plugins/python/pythonlanguageclient.cpp
@@ -151,7 +151,7 @@ PyLSClient *clientForPython(const FilePath &python)
if (auto client = pythonClients()[python])
return client;
auto interface = new PyLSInterface;
- interface->setCommandLine(CommandLine(python, {"-m", "pylsp"}));
+ interface->setCommandLine({python, {"-m", "pylsp"}});
auto client = new PyLSClient(interface);
client->setName(Tr::tr("Python Language Server (%1)").arg(python.toUserOutput()));
client->setActivateDocumentAutomatically(true);
diff --git a/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp b/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp
index 7799c96028..a417775dbf 100644
--- a/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp
+++ b/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp
@@ -43,7 +43,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
serverUrl.setPath("invalid");
runControl = new RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
- runControl->setCommandLine({"\\-/|\\-/", {}});
+ runControl->setCommandLine(CommandLine{"\\-/|\\-/"});
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
@@ -109,7 +109,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
serverUrl.clear();
serverUrl = Utils::urlFromLocalHostAndFreePort();
runControl = new RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
- runControl->setCommandLine({app, {}});
+ runControl->setCommandLine(CommandLine{app});
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
connectRunner();
runControl->initiateStart();
diff --git a/src/plugins/qnx/slog2inforunner.cpp b/src/plugins/qnx/slog2inforunner.cpp
index e717e56e33..b7ed28ffd2 100644
--- a/src/plugins/qnx/slog2inforunner.cpp
+++ b/src/plugins/qnx/slog2inforunner.cpp
@@ -35,7 +35,7 @@ void Slog2InfoRunner::start()
QTC_CHECK(!m_taskTreeRunner.isRunning());
const auto onTestSetup = [this](Process &process) {
- process.setCommand({device()->filePath("slog2info"), {}});
+ process.setCommand(CommandLine{device()->filePath("slog2info")});
};
const auto onTestDone = [this](DoneWith result) {
if (result == DoneWith::Success) {
diff --git a/src/plugins/remotelinux/filesystemaccess_test.cpp b/src/plugins/remotelinux/filesystemaccess_test.cpp
index 0f2e5bd937..b9e77f79e9 100644
--- a/src/plugins/remotelinux/filesystemaccess_test.cpp
+++ b/src/plugins/remotelinux/filesystemaccess_test.cpp
@@ -188,7 +188,7 @@ void FileSystemAccessTest::testWorkingDirectory()
const FilePath dir = baseFilePath() / "testdir with space and 'various' \"quotes\" here";
QVERIFY(dir.ensureWritableDir());
Process proc;
- proc.setCommand({"pwd", {}});
+ proc.setCommand(CommandLine{"pwd"});
proc.setWorkingDirectory(dir);
proc.start();
QVERIFY(proc.waitForFinished());
diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp
index 8d3b46eb1b..586d3d61f2 100644
--- a/src/plugins/remotelinux/linuxdevice.cpp
+++ b/src/plugins/remotelinux/linuxdevice.cpp
@@ -367,7 +367,7 @@ Environment LinuxDevicePrivate::getEnvironment()
return m_environmentCache.value();
Process getEnvProc;
- getEnvProc.setCommand({q->filePath("env"), {}});
+ getEnvProc.setCommand(CommandLine{q->filePath("env")});
getEnvProc.runBlocking();
const QString remoteOutput = getEnvProc.cleanedStdOut();
@@ -1041,7 +1041,7 @@ LinuxDevice::LinuxDevice()
// specify the shell executable.
const QString shell = env.hasChanges() ? env.value_or("SHELL", "/bin/sh") : QString();
- proc->setCommand({filePath(shell), {}});
+ proc->setCommand(CommandLine{filePath(shell)});
proc->setTerminalMode(TerminalMode::Run);
proc->setEnvironment(env);
proc->setWorkingDirectory(workingDir);
diff --git a/src/plugins/terminal/shellmodel.cpp b/src/plugins/terminal/shellmodel.cpp
index 4368efee97..dd45515b09 100644
--- a/src/plugins/terminal/shellmodel.cpp
+++ b/src/plugins/terminal/shellmodel.cpp
@@ -168,7 +168,7 @@ QList<ShellModelItem> ShellModel::remote() const
ProjectExplorer::DeviceManager::instance()->forEachDevice(
[&result](const std::shared_ptr<const ProjectExplorer::IDevice> &device) {
if (device->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
- result << ShellModelItem{device->displayName(), {{device->rootPath(), {}}}};
+ result << ShellModelItem{device->displayName(), {CommandLine{device->rootPath()}}};
});
return result;
diff --git a/src/plugins/terminal/terminalpane.cpp b/src/plugins/terminal/terminalpane.cpp
index 1648638713..8b6699ef77 100644
--- a/src/plugins/terminal/terminalpane.cpp
+++ b/src/plugins/terminal/terminalpane.cpp
@@ -115,7 +115,7 @@ void TerminalPane::openTerminal(const OpenTerminalParameters &parameters)
if (!shell.isExecutableFile())
parametersCopy.workingDirectory.reset();
else
- parametersCopy.shellCommand = CommandLine{shell, {}};
+ parametersCopy.shellCommand = CommandLine{shell};
}
const auto terminalWidget = new TerminalWidget(&m_tabWidget, parametersCopy);
diff --git a/src/plugins/valgrind/valgrindmemcheckparsertest.cpp b/src/plugins/valgrind/valgrindmemcheckparsertest.cpp
index 44cac3712c..ee87ded684 100644
--- a/src/plugins/valgrind/valgrindmemcheckparsertest.cpp
+++ b/src/plugins/valgrind/valgrindmemcheckparsertest.cpp
@@ -545,7 +545,7 @@ void ValgrindMemcheckParserTest::testRealValgrind()
debuggee.command.setExecutable(FilePath::fromString(executable));
debuggee.environment = sysEnv;
ValgrindProcess runner;
- runner.setValgrindCommand({"valgrind", {}});
+ runner.setValgrindCommand(CommandLine{"valgrind"});
runner.setDebuggee(debuggee);
RunnerDumper dumper(&runner);
runner.runBlocking();
diff --git a/tests/auto/utils/deviceshell/tst_deviceshell.cpp b/tests/auto/utils/deviceshell/tst_deviceshell.cpp
index f94d0dc5b4..75150add83 100644
--- a/tests/auto/utils/deviceshell/tst_deviceshell.cpp
+++ b/tests/auto/utils/deviceshell/tst_deviceshell.cpp
@@ -111,7 +111,7 @@ private slots:
const FilePath executable = Environment::systemEnvironment()
.searchInPath(shell, {"/usr/local/bin"});
if (executable.exists())
- m_availableShells.append({executable, {}});
+ m_availableShells.append(CommandLine{executable});
}
}
@@ -210,7 +210,7 @@ private slots:
QRandomGenerator generator;
- const RunResult result = shell.runInShell({"cat", {}}, testData.toUtf8());
+ const RunResult result = shell.runInShell(CommandLine{"cat"}, testData.toUtf8());
QCOMPARE(result.exitCode, 0);
const QString resultAsUtf8 = QString::fromUtf8(result.stdOut);
QCOMPARE(resultAsUtf8.size(), testData.size());
@@ -236,7 +236,7 @@ private slots:
TestShell shell(cmdLine);
QCOMPARE(shell.state(), DeviceShell::State::Succeeded);
- const RunResult result = shell.runInShell({"cat", {}}, m_asciiTestData);
+ const RunResult result = shell.runInShell(CommandLine{"cat"}, m_asciiTestData);
QCOMPARE(result.stdOut, m_asciiTestData);
}
@@ -259,7 +259,7 @@ private slots:
TestShell shell(cmdLine);
QCOMPARE(shell.state(), DeviceShell::State::Succeeded);
- const RunResult result = shell.runInShell({"cat", {}}, m_asciiTestData);
+ const RunResult result = shell.runInShell(CommandLine{"cat"}, m_asciiTestData);
QCOMPARE(result.stdOut, m_asciiTestData);
QVERIFY(result.stdErr.isEmpty());
diff --git a/tests/auto/utils/process/processtestapp/processtestapp.cpp b/tests/auto/utils/process/processtestapp/processtestapp.cpp
index 0148d1e261..b85cdabede 100644
--- a/tests/auto/utils/process/processtestapp/processtestapp.cpp
+++ b/tests/auto/utils/process/processtestapp/processtestapp.cpp
@@ -84,7 +84,7 @@ void SubProcessConfig::setupSubProcess(Process *subProcess) const
subProcess->setEnvironment(m_environment);
const FilePath filePath = FilePath::fromString(s_pathToProcessTestApp
+ QLatin1String("/processtestapp")).withExecutableSuffix();
- subProcess->setCommand(CommandLine(filePath, {}));
+ subProcess->setCommand(CommandLine{filePath});
}
void SubProcessConfig::setupSubProcess(QProcess *subProcess) const
diff --git a/tests/auto/utils/process/tst_process.cpp b/tests/auto/utils/process/tst_process.cpp
index cd9f871515..a1e92edfe2 100644
--- a/tests/auto/utils/process/tst_process.cpp
+++ b/tests/auto/utils/process/tst_process.cpp
@@ -114,7 +114,7 @@ private slots:
QCOMPARE(qproc.exitCode(), 0);
Process proc;
- proc.setCommand({envPath, {}});
+ proc.setCommand(CommandLine{envPath});
proc.runBlocking();
QCOMPARE(proc.exitCode(), 0);
const QByteArray output = proc.rawStdOut() + proc.rawStdErr();
@@ -1138,8 +1138,7 @@ void tst_Process::notRunningAfterStartingNonExistingProgram()
QFETCH(ProcessSignalType, signalType);
Process process;
- process.setCommand({ FilePath::fromString(
- "there_is_a_big_chance_that_executable_with_that_name_does_not_exists"), {} });
+ process.setCommand(CommandLine{"there_is_a_big_chance_that_executable_with_that_name_does_not_exists"});
int doneCount = 0;
QObject::connect(&process, &Process::done, [&process, &doneCount]() {
@@ -1556,7 +1555,7 @@ void tst_Process::stdinToShell()
QSKIP("Skipping env test on Windows");
Process proc;
- proc.setCommand({"sh", {}});
+ proc.setCommand(CommandLine{"sh"});
proc.setWriteData("echo hallo");
proc.runBlocking();
@@ -1595,8 +1594,8 @@ void tst_Process::eventLoopMode()
{
Process process;
- process.setCommand({FilePath::fromString(
- "there_is_a_big_chance_that_executable_with_that_name_does_not_exists"), {} });
+ process.setCommand(
+ CommandLine{"there_is_a_big_chance_that_executable_with_that_name_does_not_exists"});
process.setProcessImpl(processImpl);
process.runBlocking(10s, eventLoopMode);
QCOMPARE(process.result(), ProcessResult::StartFailed);
diff --git a/tests/manual/deviceshell/tst_deviceshell.cpp b/tests/manual/deviceshell/tst_deviceshell.cpp
index 96638763f8..88f95fd711 100644
--- a/tests/manual/deviceshell/tst_deviceshell.cpp
+++ b/tests/manual/deviceshell/tst_deviceshell.cpp
@@ -33,19 +33,17 @@ public:
const FilePath shExecutable = Environment::systemEnvironment()
.searchInPath("sh", {"/usr/local/bin"});
- if (dockerExecutable.exists()) {
+ if (dockerExecutable.exists())
cmd = {dockerExecutable, {"run", "-i", "--rm","alpine"}};
- } else if (dashExecutable.exists()) {
- cmd = {dashExecutable, {}};
- } else if (bashExecutable.exists()) {
- cmd = {bashExecutable, {}};
- } else if (shExecutable.exists()) {
- cmd = {shExecutable, {}};
- }
-
- if (cmd.isEmpty()) {
+ else if (dashExecutable.exists())
+ cmd = CommandLine{dashExecutable};
+ else if (bashExecutable.exists())
+ cmd = CommandLine{bashExecutable};
+ else if (shExecutable.exists())
+ cmd = CommandLine{shExecutable};
+
+ if (cmd.isEmpty())
return cmd;
- }
qDebug() << "Using shell cmd:" << cmd;
}
@@ -97,7 +95,7 @@ class tst_DeviceShell : public QObject
t.start();
const auto cat = [&shell](const QByteArray &data) {
- return shell.runInShell({"cat", {}}, data).stdOut;
+ return shell.runInShell(CommandLine{"cat"}, data).stdOut;
};
const QList<QByteArray> results = QtConcurrent::blockingMapped(testArray, cat);
QCOMPARE(results, testArray);
@@ -164,7 +162,7 @@ private slots:
TestShell shell;
QCOMPARE(shell.state(), DeviceShell::State::Succeeded);
- const RunResult r = shell.runInShell({"cat", {}}, utf8string.toUtf8());
+ const RunResult r = shell.runInShell(CommandLine{"cat"}, utf8string.toUtf8());
const QString output = QString::fromUtf8(r.stdOut);
QCOMPARE(output, utf8string);
}