forked from qt-creator/qt-creator
CommandLine: Use more 1-arg c'tor
Change-Id: If52c4094f94859d51e31862d913b1756e333e512 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -181,7 +181,7 @@ expected_str<qint64> ProcessStubCreator::startStubProcess(const ProcessSetupData
|
|||||||
process->setProcessMode(ProcessMode::Writer);
|
process->setProcessMode(ProcessMode::Writer);
|
||||||
} else {
|
} else {
|
||||||
QString extraArgsFromOptions = terminal.executeArgs;
|
QString extraArgsFromOptions = terminal.executeArgs;
|
||||||
CommandLine cmdLine = {terminal.command, {}};
|
CommandLine cmdLine{terminal.command};
|
||||||
if (!extraArgsFromOptions.isEmpty())
|
if (!extraArgsFromOptions.isEmpty())
|
||||||
cmdLine.addArgs(extraArgsFromOptions, CommandLine::Raw);
|
cmdLine.addArgs(extraArgsFromOptions, CommandLine::Raw);
|
||||||
cmdLine.addCommandLineAsArgs(setupData.m_commandLine, CommandLine::Raw);
|
cmdLine.addCommandLineAsArgs(setupData.m_commandLine, CommandLine::Raw);
|
||||||
|
@@ -402,7 +402,7 @@ void TerminalInterface::start()
|
|||||||
m_setup.m_commandLine.executable().fileName());
|
m_setup.m_commandLine.executable().fileName());
|
||||||
|
|
||||||
if (m_setup.m_runAsRoot && !HostOsInfo::isWindowsHost()) {
|
if (m_setup.m_runAsRoot && !HostOsInfo::isWindowsHost()) {
|
||||||
CommandLine rootCommand("sudo", {});
|
CommandLine rootCommand("sudo");
|
||||||
rootCommand.addCommandLineAsArgs(cmd);
|
rootCommand.addCommandLineAsArgs(cmd);
|
||||||
stubSetupData.m_commandLine = rootCommand;
|
stubSetupData.m_commandLine = rootCommand;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -383,7 +383,7 @@ void TestRunner::runTestsHelper()
|
|||||||
connect(testStorage->m_outputReader.get(), &TestOutputReader::newOutputLineAvailable,
|
connect(testStorage->m_outputReader.get(), &TestOutputReader::newOutputLineAvailable,
|
||||||
TestResultsPane::instance(), &TestResultsPane::addOutputLine);
|
TestResultsPane::instance(), &TestResultsPane::addOutputLine);
|
||||||
|
|
||||||
CommandLine command{config->testExecutable(), {}};
|
CommandLine command{config->testExecutable()};
|
||||||
if (config->testBase()->type() == ITestBase::Framework) {
|
if (config->testBase()->type() == ITestBase::Framework) {
|
||||||
TestConfiguration *current = static_cast<TestConfiguration *>(config);
|
TestConfiguration *current = static_cast<TestConfiguration *>(config);
|
||||||
QStringList omitted;
|
QStringList omitted;
|
||||||
|
@@ -151,7 +151,7 @@ QString EBlinkGdbServerProvider::channelString() const
|
|||||||
|
|
||||||
CommandLine EBlinkGdbServerProvider::command() const
|
CommandLine EBlinkGdbServerProvider::command() const
|
||||||
{
|
{
|
||||||
CommandLine cmd{m_executableFile, {}};
|
CommandLine cmd{m_executableFile};
|
||||||
QStringList interFaceTypeStrings = {"swd", "jtag"};
|
QStringList interFaceTypeStrings = {"swd", "jtag"};
|
||||||
|
|
||||||
// Obligatorily -I
|
// Obligatorily -I
|
||||||
|
@@ -131,7 +131,7 @@ QString StLinkUtilGdbServerProvider::channelString() const
|
|||||||
|
|
||||||
CommandLine StLinkUtilGdbServerProvider::command() const
|
CommandLine StLinkUtilGdbServerProvider::command() const
|
||||||
{
|
{
|
||||||
CommandLine cmd{m_executableFile, {}};
|
CommandLine cmd{m_executableFile};
|
||||||
|
|
||||||
if (m_extendedMode)
|
if (m_extendedMode)
|
||||||
cmd.addArg("--multi");
|
cmd.addArg("--multi");
|
||||||
|
@@ -111,7 +111,7 @@ QdbDevice::QdbDevice()
|
|||||||
setType(Constants::QdbLinuxOsType);
|
setType(Constants::QdbLinuxOsType);
|
||||||
|
|
||||||
addDeviceAction({Tr::tr("Reboot Device"), [](const IDevice::Ptr &device, QWidget *) {
|
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 *) {
|
addDeviceAction({Tr::tr("Restore Default App"), [](const IDevice::Ptr &device, QWidget *) {
|
||||||
|
@@ -48,7 +48,7 @@ static void startFlashingWizard()
|
|||||||
if (HostOsInfo::isWindowsHost()) {
|
if (HostOsInfo::isWindowsHost()) {
|
||||||
if (Process::startDetached({"explorer.exe", {filePath.toUserOutput()}}))
|
if (Process::startDetached({"explorer.exe", {filePath.toUserOutput()}}))
|
||||||
return;
|
return;
|
||||||
} else if (Process::startDetached({filePath, {}})) {
|
} else if (Process::startDetached(CommandLine{filePath})) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const QString message = Tr::tr("Flash wizard \"%1\" failed to start.");
|
const QString message = Tr::tr("Flash wizard \"%1\" failed to start.");
|
||||||
|
@@ -605,7 +605,7 @@ DockerDevice::DockerDevice(std::unique_ptr<DockerDeviceSettings> deviceSettings)
|
|||||||
proc.setTerminalMode(TerminalMode::Detached);
|
proc.setTerminalMode(TerminalMode::Detached);
|
||||||
proc.setEnvironment(env);
|
proc.setEnvironment(env);
|
||||||
proc.setWorkingDirectory(workingDir);
|
proc.setWorkingDirectory(workingDir);
|
||||||
proc.setCommand({*shell, {}});
|
proc.setCommand(CommandLine{*shell});
|
||||||
proc.start();
|
proc.start();
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
@@ -1057,13 +1057,13 @@ expected_str<void> DockerDevicePrivate::fetchSystemEnviroment()
|
|||||||
QString stdErr;
|
QString stdErr;
|
||||||
|
|
||||||
if (m_shell && m_shell->state() == DeviceShell::State::Succeeded) {
|
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);
|
const QString out = QString::fromUtf8(result.stdOut);
|
||||||
m_cachedEnviroment = Environment(out.split('\n', Qt::SkipEmptyParts), q->osType());
|
m_cachedEnviroment = Environment(out.split('\n', Qt::SkipEmptyParts), q->osType());
|
||||||
stdErr = QString::fromUtf8(result.stdErr);
|
stdErr = QString::fromUtf8(result.stdErr);
|
||||||
} else {
|
} else {
|
||||||
Process proc;
|
Process proc;
|
||||||
proc.setCommand(withDockerExecCmd({"env", {}}));
|
proc.setCommand(withDockerExecCmd(CommandLine{"env"}));
|
||||||
proc.start();
|
proc.start();
|
||||||
proc.waitForFinished();
|
proc.waitForFinished();
|
||||||
const QString remoteOutput = proc.cleanedStdOut();
|
const QString remoteOutput = proc.cleanedStdOut();
|
||||||
|
@@ -2531,7 +2531,7 @@ bool GitClient::launchGitBash(const FilePath &workingDirectory)
|
|||||||
success = false;
|
success = false;
|
||||||
} else {
|
} else {
|
||||||
const FilePath gitBash = git.absolutePath().parentDir() / "git-bash.exe";
|
const FilePath gitBash = git.absolutePath().parentDir() / "git-bash.exe";
|
||||||
success = Process::startDetached({gitBash, {}}, workingDirectory);
|
success = Process::startDetached(CommandLine{gitBash}, workingDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@@ -101,7 +101,7 @@ void PerfTracePointDialog::runScript()
|
|||||||
if (elevate != QLatin1String(ELEVATE_METHOD_NA))
|
if (elevate != QLatin1String(ELEVATE_METHOD_NA))
|
||||||
m_process->setCommand({m_device->filePath(elevate), {"sh"}});
|
m_process->setCommand({m_device->filePath(elevate), {"sh"}});
|
||||||
else
|
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);
|
connect(m_process.get(), &Process::done, this, &PerfTracePointDialog::handleProcessDone);
|
||||||
m_process->start();
|
m_process->start();
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
#include "../projectexplorerconstants.h"
|
#include "../projectexplorerconstants.h"
|
||||||
#include "../projectexplorertr.h"
|
#include "../projectexplorertr.h"
|
||||||
#include "desktopprocesssignaloperation.h"
|
#include "desktopprocesssignaloperation.h"
|
||||||
#include "processlist.h"
|
|
||||||
|
|
||||||
#include <coreplugin/fileutils.h>
|
#include <coreplugin/fileutils.h>
|
||||||
|
|
||||||
@@ -21,7 +20,6 @@
|
|||||||
#include <utils/url.h>
|
#include <utils/url.h>
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDateTime>
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@@ -65,7 +63,7 @@ DesktopDevice::DesktopDevice()
|
|||||||
Process process;
|
Process process;
|
||||||
process.setTerminalMode(TerminalMode::Detached);
|
process.setTerminalMode(TerminalMode::Detached);
|
||||||
process.setEnvironment(realEnv);
|
process.setEnvironment(realEnv);
|
||||||
process.setCommand({*shell, {}});
|
process.setCommand(CommandLine{*shell});
|
||||||
process.setWorkingDirectory(path);
|
process.setWorkingDirectory(path);
|
||||||
process.start();
|
process.start();
|
||||||
|
|
||||||
|
@@ -3616,7 +3616,7 @@ void ProjectExplorerPluginPrivate::openTerminalHere(const EnvironmentGetter &env
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (buildDevice->rootPath().needsDevice())
|
if (buildDevice->rootPath().needsDevice())
|
||||||
Terminal::Hooks::instance().openTerminal({CommandLine{*shell, {}}, workingDir, environment});
|
Terminal::Hooks::instance().openTerminal({CommandLine{*shell}, workingDir, environment});
|
||||||
else
|
else
|
||||||
Terminal::Hooks::instance().openTerminal({workingDir, environment});
|
Terminal::Hooks::instance().openTerminal({workingDir, environment});
|
||||||
}
|
}
|
||||||
@@ -3656,8 +3656,8 @@ void ProjectExplorerPluginPrivate::openTerminalHereWithRunEnv()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (device->rootPath().needsDevice()) {
|
if (device->rootPath().needsDevice()) {
|
||||||
Terminal::Hooks::instance().openTerminal(
|
Terminal::Hooks::instance().openTerminal({CommandLine{*shell}, workingDir,
|
||||||
{CommandLine{*shell, {}}, workingDir, runnable.environment});
|
runnable.environment});
|
||||||
} else {
|
} else {
|
||||||
Terminal::Hooks::instance().openTerminal({workingDir, runnable.environment});
|
Terminal::Hooks::instance().openTerminal({workingDir, runnable.environment});
|
||||||
}
|
}
|
||||||
|
@@ -151,7 +151,7 @@ PyLSClient *clientForPython(const FilePath &python)
|
|||||||
if (auto client = pythonClients()[python])
|
if (auto client = pythonClients()[python])
|
||||||
return client;
|
return client;
|
||||||
auto interface = new PyLSInterface;
|
auto interface = new PyLSInterface;
|
||||||
interface->setCommandLine(CommandLine(python, {"-m", "pylsp"}));
|
interface->setCommandLine({python, {"-m", "pylsp"}});
|
||||||
auto client = new PyLSClient(interface);
|
auto client = new PyLSClient(interface);
|
||||||
client->setName(Tr::tr("Python Language Server (%1)").arg(python.toUserOutput()));
|
client->setName(Tr::tr("Python Language Server (%1)").arg(python.toUserOutput()));
|
||||||
client->setActivateDocumentAutomatically(true);
|
client->setActivateDocumentAutomatically(true);
|
||||||
|
@@ -43,7 +43,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
|
|||||||
serverUrl.setPath("invalid");
|
serverUrl.setPath("invalid");
|
||||||
|
|
||||||
runControl = new RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
runControl = new RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||||
runControl->setCommandLine({"\\-/|\\-/", {}});
|
runControl->setCommandLine(CommandLine{"\\-/|\\-/"});
|
||||||
|
|
||||||
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
|
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
|
|||||||
serverUrl.clear();
|
serverUrl.clear();
|
||||||
serverUrl = Utils::urlFromLocalHostAndFreePort();
|
serverUrl = Utils::urlFromLocalHostAndFreePort();
|
||||||
runControl = new RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
runControl = new RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||||
runControl->setCommandLine({app, {}});
|
runControl->setCommandLine(CommandLine{app});
|
||||||
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
|
profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
|
||||||
connectRunner();
|
connectRunner();
|
||||||
runControl->initiateStart();
|
runControl->initiateStart();
|
||||||
|
@@ -35,7 +35,7 @@ void Slog2InfoRunner::start()
|
|||||||
QTC_CHECK(!m_taskTreeRunner.isRunning());
|
QTC_CHECK(!m_taskTreeRunner.isRunning());
|
||||||
|
|
||||||
const auto onTestSetup = [this](Process &process) {
|
const auto onTestSetup = [this](Process &process) {
|
||||||
process.setCommand({device()->filePath("slog2info"), {}});
|
process.setCommand(CommandLine{device()->filePath("slog2info")});
|
||||||
};
|
};
|
||||||
const auto onTestDone = [this](DoneWith result) {
|
const auto onTestDone = [this](DoneWith result) {
|
||||||
if (result == DoneWith::Success) {
|
if (result == DoneWith::Success) {
|
||||||
|
@@ -188,7 +188,7 @@ void FileSystemAccessTest::testWorkingDirectory()
|
|||||||
const FilePath dir = baseFilePath() / "testdir with space and 'various' \"quotes\" here";
|
const FilePath dir = baseFilePath() / "testdir with space and 'various' \"quotes\" here";
|
||||||
QVERIFY(dir.ensureWritableDir());
|
QVERIFY(dir.ensureWritableDir());
|
||||||
Process proc;
|
Process proc;
|
||||||
proc.setCommand({"pwd", {}});
|
proc.setCommand(CommandLine{"pwd"});
|
||||||
proc.setWorkingDirectory(dir);
|
proc.setWorkingDirectory(dir);
|
||||||
proc.start();
|
proc.start();
|
||||||
QVERIFY(proc.waitForFinished());
|
QVERIFY(proc.waitForFinished());
|
||||||
|
@@ -367,7 +367,7 @@ Environment LinuxDevicePrivate::getEnvironment()
|
|||||||
return m_environmentCache.value();
|
return m_environmentCache.value();
|
||||||
|
|
||||||
Process getEnvProc;
|
Process getEnvProc;
|
||||||
getEnvProc.setCommand({q->filePath("env"), {}});
|
getEnvProc.setCommand(CommandLine{q->filePath("env")});
|
||||||
getEnvProc.runBlocking();
|
getEnvProc.runBlocking();
|
||||||
|
|
||||||
const QString remoteOutput = getEnvProc.cleanedStdOut();
|
const QString remoteOutput = getEnvProc.cleanedStdOut();
|
||||||
@@ -1041,7 +1041,7 @@ LinuxDevice::LinuxDevice()
|
|||||||
// specify the shell executable.
|
// specify the shell executable.
|
||||||
const QString shell = env.hasChanges() ? env.value_or("SHELL", "/bin/sh") : QString();
|
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->setTerminalMode(TerminalMode::Run);
|
||||||
proc->setEnvironment(env);
|
proc->setEnvironment(env);
|
||||||
proc->setWorkingDirectory(workingDir);
|
proc->setWorkingDirectory(workingDir);
|
||||||
|
@@ -168,7 +168,7 @@ QList<ShellModelItem> ShellModel::remote() const
|
|||||||
ProjectExplorer::DeviceManager::instance()->forEachDevice(
|
ProjectExplorer::DeviceManager::instance()->forEachDevice(
|
||||||
[&result](const std::shared_ptr<const ProjectExplorer::IDevice> &device) {
|
[&result](const std::shared_ptr<const ProjectExplorer::IDevice> &device) {
|
||||||
if (device->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
|
if (device->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
|
||||||
result << ShellModelItem{device->displayName(), {{device->rootPath(), {}}}};
|
result << ShellModelItem{device->displayName(), {CommandLine{device->rootPath()}}};
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -115,7 +115,7 @@ void TerminalPane::openTerminal(const OpenTerminalParameters ¶meters)
|
|||||||
if (!shell.isExecutableFile())
|
if (!shell.isExecutableFile())
|
||||||
parametersCopy.workingDirectory.reset();
|
parametersCopy.workingDirectory.reset();
|
||||||
else
|
else
|
||||||
parametersCopy.shellCommand = CommandLine{shell, {}};
|
parametersCopy.shellCommand = CommandLine{shell};
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto terminalWidget = new TerminalWidget(&m_tabWidget, parametersCopy);
|
const auto terminalWidget = new TerminalWidget(&m_tabWidget, parametersCopy);
|
||||||
|
@@ -545,7 +545,7 @@ void ValgrindMemcheckParserTest::testRealValgrind()
|
|||||||
debuggee.command.setExecutable(FilePath::fromString(executable));
|
debuggee.command.setExecutable(FilePath::fromString(executable));
|
||||||
debuggee.environment = sysEnv;
|
debuggee.environment = sysEnv;
|
||||||
ValgrindProcess runner;
|
ValgrindProcess runner;
|
||||||
runner.setValgrindCommand({"valgrind", {}});
|
runner.setValgrindCommand(CommandLine{"valgrind"});
|
||||||
runner.setDebuggee(debuggee);
|
runner.setDebuggee(debuggee);
|
||||||
RunnerDumper dumper(&runner);
|
RunnerDumper dumper(&runner);
|
||||||
runner.runBlocking();
|
runner.runBlocking();
|
||||||
|
@@ -111,7 +111,7 @@ private slots:
|
|||||||
const FilePath executable = Environment::systemEnvironment()
|
const FilePath executable = Environment::systemEnvironment()
|
||||||
.searchInPath(shell, {"/usr/local/bin"});
|
.searchInPath(shell, {"/usr/local/bin"});
|
||||||
if (executable.exists())
|
if (executable.exists())
|
||||||
m_availableShells.append({executable, {}});
|
m_availableShells.append(CommandLine{executable});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,7 +210,7 @@ private slots:
|
|||||||
|
|
||||||
QRandomGenerator generator;
|
QRandomGenerator generator;
|
||||||
|
|
||||||
const RunResult result = shell.runInShell({"cat", {}}, testData.toUtf8());
|
const RunResult result = shell.runInShell(CommandLine{"cat"}, testData.toUtf8());
|
||||||
QCOMPARE(result.exitCode, 0);
|
QCOMPARE(result.exitCode, 0);
|
||||||
const QString resultAsUtf8 = QString::fromUtf8(result.stdOut);
|
const QString resultAsUtf8 = QString::fromUtf8(result.stdOut);
|
||||||
QCOMPARE(resultAsUtf8.size(), testData.size());
|
QCOMPARE(resultAsUtf8.size(), testData.size());
|
||||||
@@ -236,7 +236,7 @@ private slots:
|
|||||||
TestShell shell(cmdLine);
|
TestShell shell(cmdLine);
|
||||||
QCOMPARE(shell.state(), DeviceShell::State::Succeeded);
|
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);
|
QCOMPARE(result.stdOut, m_asciiTestData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,7 +259,7 @@ private slots:
|
|||||||
TestShell shell(cmdLine);
|
TestShell shell(cmdLine);
|
||||||
QCOMPARE(shell.state(), DeviceShell::State::Succeeded);
|
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);
|
QCOMPARE(result.stdOut, m_asciiTestData);
|
||||||
QVERIFY(result.stdErr.isEmpty());
|
QVERIFY(result.stdErr.isEmpty());
|
||||||
|
|
||||||
|
@@ -84,7 +84,7 @@ void SubProcessConfig::setupSubProcess(Process *subProcess) const
|
|||||||
subProcess->setEnvironment(m_environment);
|
subProcess->setEnvironment(m_environment);
|
||||||
const FilePath filePath = FilePath::fromString(s_pathToProcessTestApp
|
const FilePath filePath = FilePath::fromString(s_pathToProcessTestApp
|
||||||
+ QLatin1String("/processtestapp")).withExecutableSuffix();
|
+ QLatin1String("/processtestapp")).withExecutableSuffix();
|
||||||
subProcess->setCommand(CommandLine(filePath, {}));
|
subProcess->setCommand(CommandLine{filePath});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubProcessConfig::setupSubProcess(QProcess *subProcess) const
|
void SubProcessConfig::setupSubProcess(QProcess *subProcess) const
|
||||||
|
@@ -114,7 +114,7 @@ private slots:
|
|||||||
QCOMPARE(qproc.exitCode(), 0);
|
QCOMPARE(qproc.exitCode(), 0);
|
||||||
|
|
||||||
Process proc;
|
Process proc;
|
||||||
proc.setCommand({envPath, {}});
|
proc.setCommand(CommandLine{envPath});
|
||||||
proc.runBlocking();
|
proc.runBlocking();
|
||||||
QCOMPARE(proc.exitCode(), 0);
|
QCOMPARE(proc.exitCode(), 0);
|
||||||
const QByteArray output = proc.rawStdOut() + proc.rawStdErr();
|
const QByteArray output = proc.rawStdOut() + proc.rawStdErr();
|
||||||
@@ -1138,8 +1138,7 @@ void tst_Process::notRunningAfterStartingNonExistingProgram()
|
|||||||
QFETCH(ProcessSignalType, signalType);
|
QFETCH(ProcessSignalType, signalType);
|
||||||
|
|
||||||
Process process;
|
Process process;
|
||||||
process.setCommand({ FilePath::fromString(
|
process.setCommand(CommandLine{"there_is_a_big_chance_that_executable_with_that_name_does_not_exists"});
|
||||||
"there_is_a_big_chance_that_executable_with_that_name_does_not_exists"), {} });
|
|
||||||
|
|
||||||
int doneCount = 0;
|
int doneCount = 0;
|
||||||
QObject::connect(&process, &Process::done, [&process, &doneCount]() {
|
QObject::connect(&process, &Process::done, [&process, &doneCount]() {
|
||||||
@@ -1556,7 +1555,7 @@ void tst_Process::stdinToShell()
|
|||||||
QSKIP("Skipping env test on Windows");
|
QSKIP("Skipping env test on Windows");
|
||||||
|
|
||||||
Process proc;
|
Process proc;
|
||||||
proc.setCommand({"sh", {}});
|
proc.setCommand(CommandLine{"sh"});
|
||||||
proc.setWriteData("echo hallo");
|
proc.setWriteData("echo hallo");
|
||||||
proc.runBlocking();
|
proc.runBlocking();
|
||||||
|
|
||||||
@@ -1595,8 +1594,8 @@ void tst_Process::eventLoopMode()
|
|||||||
|
|
||||||
{
|
{
|
||||||
Process process;
|
Process process;
|
||||||
process.setCommand({FilePath::fromString(
|
process.setCommand(
|
||||||
"there_is_a_big_chance_that_executable_with_that_name_does_not_exists"), {} });
|
CommandLine{"there_is_a_big_chance_that_executable_with_that_name_does_not_exists"});
|
||||||
process.setProcessImpl(processImpl);
|
process.setProcessImpl(processImpl);
|
||||||
process.runBlocking(10s, eventLoopMode);
|
process.runBlocking(10s, eventLoopMode);
|
||||||
QCOMPARE(process.result(), ProcessResult::StartFailed);
|
QCOMPARE(process.result(), ProcessResult::StartFailed);
|
||||||
|
@@ -33,19 +33,17 @@ public:
|
|||||||
const FilePath shExecutable = Environment::systemEnvironment()
|
const FilePath shExecutable = Environment::systemEnvironment()
|
||||||
.searchInPath("sh", {"/usr/local/bin"});
|
.searchInPath("sh", {"/usr/local/bin"});
|
||||||
|
|
||||||
if (dockerExecutable.exists()) {
|
if (dockerExecutable.exists())
|
||||||
cmd = {dockerExecutable, {"run", "-i", "--rm","alpine"}};
|
cmd = {dockerExecutable, {"run", "-i", "--rm","alpine"}};
|
||||||
} else if (dashExecutable.exists()) {
|
else if (dashExecutable.exists())
|
||||||
cmd = {dashExecutable, {}};
|
cmd = CommandLine{dashExecutable};
|
||||||
} else if (bashExecutable.exists()) {
|
else if (bashExecutable.exists())
|
||||||
cmd = {bashExecutable, {}};
|
cmd = CommandLine{bashExecutable};
|
||||||
} else if (shExecutable.exists()) {
|
else if (shExecutable.exists())
|
||||||
cmd = {shExecutable, {}};
|
cmd = CommandLine{shExecutable};
|
||||||
}
|
|
||||||
|
|
||||||
if (cmd.isEmpty()) {
|
if (cmd.isEmpty())
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
|
||||||
|
|
||||||
qDebug() << "Using shell cmd:" << cmd;
|
qDebug() << "Using shell cmd:" << cmd;
|
||||||
}
|
}
|
||||||
@@ -97,7 +95,7 @@ class tst_DeviceShell : public QObject
|
|||||||
t.start();
|
t.start();
|
||||||
|
|
||||||
const auto cat = [&shell](const QByteArray &data) {
|
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);
|
const QList<QByteArray> results = QtConcurrent::blockingMapped(testArray, cat);
|
||||||
QCOMPARE(results, testArray);
|
QCOMPARE(results, testArray);
|
||||||
@@ -164,7 +162,7 @@ private slots:
|
|||||||
TestShell shell;
|
TestShell shell;
|
||||||
QCOMPARE(shell.state(), DeviceShell::State::Succeeded);
|
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);
|
const QString output = QString::fromUtf8(r.stdOut);
|
||||||
QCOMPARE(output, utf8string);
|
QCOMPARE(output, utf8string);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user