forked from qt-creator/qt-creator
ProjectExplorer: Use Runnable in DeviceProcess::start
Change-Id: I8ce5b536745db11980f43449a055b7ebf9da83d2 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com> Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
This commit is contained in:
@@ -34,6 +34,11 @@
|
|||||||
#include <debugger/debuggerstartparameters.h>
|
#include <debugger/debuggerstartparameters.h>
|
||||||
|
|
||||||
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
|
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
|
||||||
|
#include <projectexplorer/runnables.h>
|
||||||
|
|
||||||
|
#include <utils/qtcprocess.h>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace BareMetal {
|
namespace BareMetal {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -167,9 +172,10 @@ void BareMetalDebugSupport::startExecution()
|
|||||||
connect(m_appRunner, &ProjectExplorer::DeviceApplicationRunner::reportError,
|
connect(m_appRunner, &ProjectExplorer::DeviceApplicationRunner::reportError,
|
||||||
this, &BareMetalDebugSupport::appRunnerError);
|
this, &BareMetalDebugSupport::appRunnerError);
|
||||||
|
|
||||||
const QString cmd = p->executable();
|
StandardRunnable r;
|
||||||
const QStringList args = p->arguments();
|
r.executable = p->executable();
|
||||||
m_appRunner->start(m_device, cmd, args);
|
r.commandLineArguments = Utils::QtcProcess::joinArgs(p->arguments(), Utils::OsTypeLinux);
|
||||||
|
m_appRunner->start(m_device, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BareMetalDebugSupport::setFinished()
|
void BareMetalDebugSupport::setFinished()
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "gdbserverproviderprocess.h"
|
#include "gdbserverproviderprocess.h"
|
||||||
|
|
||||||
#include <projectexplorer/devicesupport/idevice.h>
|
#include <projectexplorer/devicesupport/idevice.h>
|
||||||
|
#include <projectexplorer/runnables.h>
|
||||||
|
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
@@ -33,6 +34,8 @@
|
|||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace BareMetal {
|
namespace BareMetal {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -60,12 +63,12 @@ GdbServerProviderProcess::GdbServerProviderProcess(
|
|||||||
this, &ProjectExplorer::DeviceProcess::started);
|
this, &ProjectExplorer::DeviceProcess::started);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbServerProviderProcess::start(const QString &executable, const QStringList &arguments)
|
void GdbServerProviderProcess::start(const ProjectExplorer::Runnable &runnable)
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(runnable.is<StandardRunnable>(), return);
|
||||||
QTC_ASSERT(m_process->state() == QProcess::NotRunning, return);
|
QTC_ASSERT(m_process->state() == QProcess::NotRunning, return);
|
||||||
QString args;
|
auto r = runnable.as<StandardRunnable>();
|
||||||
Utils::QtcProcess::addArgs(&args, arguments);
|
m_process->setCommand(r.executable, r.commandLineArguments);
|
||||||
m_process->setCommand(executable, args);
|
|
||||||
m_process->start();
|
m_process->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,21 +107,6 @@ QString GdbServerProviderProcess::errorString() const
|
|||||||
return m_process->errorString();
|
return m_process->errorString();
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::Environment GdbServerProviderProcess::environment() const
|
|
||||||
{
|
|
||||||
return Utils::Environment(m_process->processEnvironment().toStringList());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GdbServerProviderProcess::setEnvironment(const Utils::Environment &env)
|
|
||||||
{
|
|
||||||
m_process->setProcessEnvironment(env.toProcessEnvironment());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GdbServerProviderProcess::setWorkingDirectory(const QString &dir)
|
|
||||||
{
|
|
||||||
m_process->setWorkingDirectory(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray GdbServerProviderProcess::readAllStandardOutput()
|
QByteArray GdbServerProviderProcess::readAllStandardOutput()
|
||||||
{
|
{
|
||||||
return m_process->readAllStandardOutput();
|
return m_process->readAllStandardOutput();
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <projectexplorer/devicesupport/deviceprocess.h>
|
#include <projectexplorer/devicesupport/deviceprocess.h>
|
||||||
|
|
||||||
|
namespace ProjectExplorer { class Runnable; }
|
||||||
namespace Utils { class QtcProcess; }
|
namespace Utils { class QtcProcess; }
|
||||||
|
|
||||||
namespace BareMetal {
|
namespace BareMetal {
|
||||||
@@ -41,7 +42,7 @@ public:
|
|||||||
const QSharedPointer<const ProjectExplorer::IDevice> &device,
|
const QSharedPointer<const ProjectExplorer::IDevice> &device,
|
||||||
QObject *parent = 0);
|
QObject *parent = 0);
|
||||||
|
|
||||||
void start(const QString &executable, const QStringList &arguments);
|
void start(const ProjectExplorer::Runnable &runnable);
|
||||||
void interrupt();
|
void interrupt();
|
||||||
void terminate();
|
void terminate();
|
||||||
void kill();
|
void kill();
|
||||||
@@ -51,10 +52,6 @@ public:
|
|||||||
int exitCode() const;
|
int exitCode() const;
|
||||||
QString errorString() const;
|
QString errorString() const;
|
||||||
|
|
||||||
Utils::Environment environment() const;
|
|
||||||
void setEnvironment(const Utils::Environment &);
|
|
||||||
void setWorkingDirectory(const QString &);
|
|
||||||
|
|
||||||
QByteArray readAllStandardOutput();
|
QByteArray readAllStandardOutput();
|
||||||
QByteArray readAllStandardError();
|
QByteArray readAllStandardError();
|
||||||
|
|
||||||
|
@@ -24,7 +24,9 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "desktopdeviceprocess.h"
|
#include "desktopdeviceprocess.h"
|
||||||
|
|
||||||
#include "idevice.h"
|
#include "idevice.h"
|
||||||
|
#include "../runnables.h"
|
||||||
|
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -48,10 +50,14 @@ DesktopDeviceProcess::DesktopDeviceProcess(const QSharedPointer<const IDevice> &
|
|||||||
connect(&m_process, &QProcess::started, this, &DeviceProcess::started);
|
connect(&m_process, &QProcess::started, this, &DeviceProcess::started);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesktopDeviceProcess::start(const QString &executable, const QStringList &arguments)
|
void DesktopDeviceProcess::start(const Runnable &runnable)
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(runnable.is<StandardRunnable>(), return);
|
||||||
QTC_ASSERT(m_process.state() == QProcess::NotRunning, return);
|
QTC_ASSERT(m_process.state() == QProcess::NotRunning, return);
|
||||||
m_process.start(executable, arguments);
|
auto r = runnable.as<StandardRunnable>();
|
||||||
|
m_process.setProcessEnvironment(r.environment.toProcessEnvironment());
|
||||||
|
m_process.setWorkingDirectory(r.workingDirectory);
|
||||||
|
m_process.start(r.executable, Utils::QtcProcess::splitArgs(r.commandLineArguments));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesktopDeviceProcess::interrupt()
|
void DesktopDeviceProcess::interrupt()
|
||||||
@@ -89,21 +95,6 @@ QString DesktopDeviceProcess::errorString() const
|
|||||||
return m_process.errorString();
|
return m_process.errorString();
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::Environment DesktopDeviceProcess::environment() const
|
|
||||||
{
|
|
||||||
return Utils::Environment(m_process.processEnvironment().toStringList());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DesktopDeviceProcess::setEnvironment(const Utils::Environment &env)
|
|
||||||
{
|
|
||||||
m_process.setProcessEnvironment(env.toProcessEnvironment());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DesktopDeviceProcess::setWorkingDirectory(const QString &directory)
|
|
||||||
{
|
|
||||||
m_process.setWorkingDirectory(directory);
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray DesktopDeviceProcess::readAllStandardOutput()
|
QByteArray DesktopDeviceProcess::readAllStandardOutput()
|
||||||
{
|
{
|
||||||
return m_process.readAllStandardOutput();
|
return m_process.readAllStandardOutput();
|
||||||
|
@@ -38,7 +38,7 @@ class DesktopDeviceProcess : public DeviceProcess
|
|||||||
public:
|
public:
|
||||||
DesktopDeviceProcess(const QSharedPointer<const IDevice> &device, QObject *parent = 0);
|
DesktopDeviceProcess(const QSharedPointer<const IDevice> &device, QObject *parent = 0);
|
||||||
|
|
||||||
void start(const QString &executable, const QStringList &arguments) override;
|
void start(const Runnable &runnable) override;
|
||||||
void interrupt() override;
|
void interrupt() override;
|
||||||
void terminate() override;
|
void terminate() override;
|
||||||
void kill() override;
|
void kill() override;
|
||||||
@@ -48,11 +48,6 @@ public:
|
|||||||
int exitCode() const override;
|
int exitCode() const override;
|
||||||
QString errorString() const override;
|
QString errorString() const override;
|
||||||
|
|
||||||
Utils::Environment environment() const override;
|
|
||||||
void setEnvironment(const Utils::Environment &env) override;
|
|
||||||
|
|
||||||
void setWorkingDirectory(const QString &directory) override;
|
|
||||||
|
|
||||||
QByteArray readAllStandardOutput() override;
|
QByteArray readAllStandardOutput() override;
|
||||||
QByteArray readAllStandardError() override;
|
QByteArray readAllStandardError() override;
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "deviceapplicationrunner.h"
|
#include "deviceapplicationrunner.h"
|
||||||
|
|
||||||
#include "sshdeviceprocess.h"
|
#include "sshdeviceprocess.h"
|
||||||
|
#include "../runnables.h"
|
||||||
|
|
||||||
#include <ssh/sshconnection.h>
|
#include <ssh/sshconnection.h>
|
||||||
#include <ssh/sshconnectionmanager.h>
|
#include <ssh/sshconnectionmanager.h>
|
||||||
@@ -46,8 +47,6 @@ class DeviceApplicationRunner::DeviceApplicationRunnerPrivate
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DeviceProcess *deviceProcess;
|
DeviceProcess *deviceProcess;
|
||||||
Utils::Environment environment;
|
|
||||||
QString workingDir;
|
|
||||||
State state;
|
State state;
|
||||||
bool stopRequested;
|
bool stopRequested;
|
||||||
bool success;
|
bool success;
|
||||||
@@ -67,18 +66,7 @@ DeviceApplicationRunner::~DeviceApplicationRunner()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceApplicationRunner::setEnvironment(const Utils::Environment &env)
|
void DeviceApplicationRunner::start(const IDevice::ConstPtr &device, const Runnable &runnable)
|
||||||
{
|
|
||||||
d->environment = env;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeviceApplicationRunner::setWorkingDirectory(const QString &workingDirectory)
|
|
||||||
{
|
|
||||||
d->workingDir = workingDirectory;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeviceApplicationRunner::start(const IDevice::ConstPtr &device,
|
|
||||||
const QString &command, const QStringList &arguments)
|
|
||||||
{
|
{
|
||||||
QTC_ASSERT(d->state == Inactive, return);
|
QTC_ASSERT(d->state == Inactive, return);
|
||||||
|
|
||||||
@@ -95,7 +83,7 @@ void DeviceApplicationRunner::start(const IDevice::ConstPtr &device,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.isEmpty()) {
|
if (runnable.is<StandardRunnable>() && runnable.as<StandardRunnable>().executable.isEmpty()) {
|
||||||
doReportError(tr("Cannot run: No command given."));
|
doReportError(tr("Cannot run: No command given."));
|
||||||
setFinished();
|
setFinished();
|
||||||
return;
|
return;
|
||||||
@@ -115,9 +103,7 @@ void DeviceApplicationRunner::start(const IDevice::ConstPtr &device,
|
|||||||
this, &DeviceApplicationRunner::handleApplicationError);
|
this, &DeviceApplicationRunner::handleApplicationError);
|
||||||
connect(d->deviceProcess, &DeviceProcess::finished,
|
connect(d->deviceProcess, &DeviceProcess::finished,
|
||||||
this, &DeviceApplicationRunner::handleApplicationFinished);
|
this, &DeviceApplicationRunner::handleApplicationFinished);
|
||||||
d->deviceProcess->setEnvironment(d->environment);
|
d->deviceProcess->start(runnable);
|
||||||
d->deviceProcess->setWorkingDirectory(d->workingDir);
|
|
||||||
d->deviceProcess->start(command, arguments);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceApplicationRunner::stop()
|
void DeviceApplicationRunner::stop()
|
||||||
|
@@ -33,14 +33,10 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QStringList;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Utils { class Environment; }
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
|
class Runnable;
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT DeviceApplicationRunner : public QObject
|
class PROJECTEXPLORER_EXPORT DeviceApplicationRunner : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -49,11 +45,7 @@ public:
|
|||||||
explicit DeviceApplicationRunner(QObject *parent = 0);
|
explicit DeviceApplicationRunner(QObject *parent = 0);
|
||||||
~DeviceApplicationRunner();
|
~DeviceApplicationRunner();
|
||||||
|
|
||||||
void setEnvironment(const Utils::Environment &env);
|
void start(const IDevice::ConstPtr &device, const Runnable &runnable);
|
||||||
void setWorkingDirectory(const QString &workingDirectory);
|
|
||||||
|
|
||||||
void start(const IDevice::ConstPtr &device, const QString &command,
|
|
||||||
const QStringList &arguments);
|
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@@ -27,16 +27,17 @@
|
|||||||
#define QTC_DEVICEPROCESS_H
|
#define QTC_DEVICEPROCESS_H
|
||||||
|
|
||||||
#include "../projectexplorer_export.h"
|
#include "../projectexplorer_export.h"
|
||||||
|
#include "../runconfiguration.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
namespace Utils { class Environment; }
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class IDevice;
|
class IDevice;
|
||||||
|
class Runnable;
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT DeviceProcess : public QObject
|
class PROJECTEXPLORER_EXPORT DeviceProcess : public QObject
|
||||||
{
|
{
|
||||||
@@ -44,7 +45,7 @@ class PROJECTEXPLORER_EXPORT DeviceProcess : public QObject
|
|||||||
public:
|
public:
|
||||||
virtual ~DeviceProcess();
|
virtual ~DeviceProcess();
|
||||||
|
|
||||||
virtual void start(const QString &executable, const QStringList &arguments = QStringList()) = 0;
|
virtual void start(const Runnable &runnable) = 0;
|
||||||
virtual void interrupt() = 0;
|
virtual void interrupt() = 0;
|
||||||
virtual void terminate() = 0;
|
virtual void terminate() = 0;
|
||||||
virtual void kill() = 0;
|
virtual void kill() = 0;
|
||||||
@@ -54,11 +55,6 @@ public:
|
|||||||
virtual int exitCode() const = 0;
|
virtual int exitCode() const = 0;
|
||||||
virtual QString errorString() const = 0;
|
virtual QString errorString() const = 0;
|
||||||
|
|
||||||
virtual Utils::Environment environment() const = 0;
|
|
||||||
virtual void setEnvironment(const Utils::Environment &env) = 0;
|
|
||||||
|
|
||||||
virtual void setWorkingDirectory(const QString &workingDirectory) = 0;
|
|
||||||
|
|
||||||
virtual QByteArray readAllStandardOutput() = 0;
|
virtual QByteArray readAllStandardOutput() = 0;
|
||||||
virtual QByteArray readAllStandardError() = 0;
|
virtual QByteArray readAllStandardError() = 0;
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "sshdeviceprocess.h"
|
#include "sshdeviceprocess.h"
|
||||||
|
|
||||||
#include "idevice.h"
|
#include "idevice.h"
|
||||||
|
#include "../runnables.h"
|
||||||
|
|
||||||
#include <ssh/sshconnection.h>
|
#include <ssh/sshconnection.h>
|
||||||
#include <ssh/sshconnectionmanager.h>
|
#include <ssh/sshconnectionmanager.h>
|
||||||
@@ -47,8 +48,7 @@ public:
|
|||||||
bool serverSupportsSignals;
|
bool serverSupportsSignals;
|
||||||
QSsh::SshConnection *connection;
|
QSsh::SshConnection *connection;
|
||||||
QSsh::SshRemoteProcess::Ptr process;
|
QSsh::SshRemoteProcess::Ptr process;
|
||||||
QString executable;
|
StandardRunnable runnable;
|
||||||
QStringList arguments;
|
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
QSsh::SshRemoteProcess::ExitStatus exitStatus;
|
QSsh::SshRemoteProcess::ExitStatus exitStatus;
|
||||||
DeviceProcessSignalOperation::Ptr killOperation;
|
DeviceProcessSignalOperation::Ptr killOperation;
|
||||||
@@ -57,7 +57,6 @@ public:
|
|||||||
QByteArray stdErr;
|
QByteArray stdErr;
|
||||||
int exitCode;
|
int exitCode;
|
||||||
enum State { Inactive, Connecting, Connected, ProcessRunning } state;
|
enum State { Inactive, Connecting, Connected, ProcessRunning } state;
|
||||||
Utils::Environment environment;
|
|
||||||
|
|
||||||
void setState(State newState);
|
void setState(State newState);
|
||||||
void doSignal(QSsh::SshRemoteProcess::Signal signal);
|
void doSignal(QSsh::SshRemoteProcess::Signal signal);
|
||||||
@@ -78,15 +77,15 @@ SshDeviceProcess::~SshDeviceProcess()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SshDeviceProcess::start(const QString &executable, const QStringList &arguments)
|
void SshDeviceProcess::start(const Runnable &runnable)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(d->state == SshDeviceProcessPrivate::Inactive, return);
|
QTC_ASSERT(d->state == SshDeviceProcessPrivate::Inactive, return);
|
||||||
|
QTC_ASSERT(runnable.is<StandardRunnable>(), return);
|
||||||
d->setState(SshDeviceProcessPrivate::Connecting);
|
d->setState(SshDeviceProcessPrivate::Connecting);
|
||||||
|
|
||||||
d->errorMessage.clear();
|
d->errorMessage.clear();
|
||||||
d->exitCode = -1;
|
d->exitCode = -1;
|
||||||
d->executable = executable;
|
d->runnable = runnable.as<StandardRunnable>();
|
||||||
d->arguments = arguments;
|
|
||||||
d->connection = QSsh::acquireConnection(device()->sshParameters());
|
d->connection = QSsh::acquireConnection(device()->sshParameters());
|
||||||
connect(d->connection, SIGNAL(error(QSsh::SshError)), SLOT(handleConnectionError()));
|
connect(d->connection, SIGNAL(error(QSsh::SshError)), SLOT(handleConnectionError()));
|
||||||
connect(d->connection, SIGNAL(disconnected()), SLOT(handleDisconnected()));
|
connect(d->connection, SIGNAL(disconnected()), SLOT(handleDisconnected()));
|
||||||
@@ -115,16 +114,6 @@ void SshDeviceProcess::kill()
|
|||||||
d->doSignal(QSsh::SshRemoteProcess::KillSignal);
|
d->doSignal(QSsh::SshRemoteProcess::KillSignal);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SshDeviceProcess::executable() const
|
|
||||||
{
|
|
||||||
return d->executable;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList SshDeviceProcess::arguments() const
|
|
||||||
{
|
|
||||||
return d->arguments;
|
|
||||||
}
|
|
||||||
|
|
||||||
QProcess::ProcessState SshDeviceProcess::state() const
|
QProcess::ProcessState SshDeviceProcess::state() const
|
||||||
{
|
{
|
||||||
switch (d->state) {
|
switch (d->state) {
|
||||||
@@ -157,16 +146,6 @@ QString SshDeviceProcess::errorString() const
|
|||||||
return d->errorMessage;
|
return d->errorMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::Environment SshDeviceProcess::environment() const
|
|
||||||
{
|
|
||||||
return d->environment;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SshDeviceProcess::setEnvironment(const Utils::Environment &env)
|
|
||||||
{
|
|
||||||
d->environment = env;
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray SshDeviceProcess::readAllStandardOutput()
|
QByteArray SshDeviceProcess::readAllStandardOutput()
|
||||||
{
|
{
|
||||||
const QByteArray data = d->stdOut;
|
const QByteArray data = d->stdOut;
|
||||||
@@ -191,14 +170,14 @@ void SshDeviceProcess::handleConnected()
|
|||||||
QTC_ASSERT(d->state == SshDeviceProcessPrivate::Connecting, return);
|
QTC_ASSERT(d->state == SshDeviceProcessPrivate::Connecting, return);
|
||||||
d->setState(SshDeviceProcessPrivate::Connected);
|
d->setState(SshDeviceProcessPrivate::Connected);
|
||||||
|
|
||||||
d->process = d->connection->createRemoteProcess(fullCommandLine().toUtf8());
|
d->process = d->connection->createRemoteProcess(fullCommandLine(d->runnable).toUtf8());
|
||||||
connect(d->process.data(), SIGNAL(started()), SLOT(handleProcessStarted()));
|
connect(d->process.data(), SIGNAL(started()), SLOT(handleProcessStarted()));
|
||||||
connect(d->process.data(), SIGNAL(closed(int)), SLOT(handleProcessFinished(int)));
|
connect(d->process.data(), SIGNAL(closed(int)), SLOT(handleProcessFinished(int)));
|
||||||
connect(d->process.data(), SIGNAL(readyReadStandardOutput()), SLOT(handleStdout()));
|
connect(d->process.data(), SIGNAL(readyReadStandardOutput()), SLOT(handleStdout()));
|
||||||
connect(d->process.data(), SIGNAL(readyReadStandardError()), SLOT(handleStderr()));
|
connect(d->process.data(), SIGNAL(readyReadStandardError()), SLOT(handleStderr()));
|
||||||
|
|
||||||
d->process->clearEnvironment();
|
d->process->clearEnvironment();
|
||||||
const Utils::Environment env = environment();
|
const Utils::Environment env = d->runnable.environment;
|
||||||
for (Utils::Environment::const_iterator it = env.constBegin(); it != env.constEnd(); ++it)
|
for (Utils::Environment::const_iterator it = env.constBegin(); it != env.constEnd(); ++it)
|
||||||
d->process->addToEnvironment(env.key(it).toUtf8(), env.value(it).toUtf8());
|
d->process->addToEnvironment(env.key(it).toUtf8(), env.value(it).toUtf8());
|
||||||
d->process->start();
|
d->process->start();
|
||||||
@@ -292,11 +271,11 @@ void SshDeviceProcess::handleKillOperationTimeout()
|
|||||||
emit finished();
|
emit finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SshDeviceProcess::fullCommandLine() const
|
QString SshDeviceProcess::fullCommandLine(const StandardRunnable &runnable) const
|
||||||
{
|
{
|
||||||
QString cmdLine = executable();
|
QString cmdLine = runnable.executable;
|
||||||
if (!arguments().isEmpty())
|
if (!runnable.commandLineArguments.isEmpty())
|
||||||
cmdLine.append(QLatin1Char(' ')).append(arguments().join(QLatin1Char(' ')));
|
cmdLine.append(QLatin1Char(' ')).append(runnable.commandLineArguments);
|
||||||
return cmdLine;
|
return cmdLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,7 +297,7 @@ void SshDeviceProcess::SshDeviceProcessPrivate::doSignal(QSsh::SshRemoteProcess:
|
|||||||
} else {
|
} else {
|
||||||
DeviceProcessSignalOperation::Ptr signalOperation = q->device()->signalOperation();
|
DeviceProcessSignalOperation::Ptr signalOperation = q->device()->signalOperation();
|
||||||
if (signal == QSsh::SshRemoteProcess::IntSignal) {
|
if (signal == QSsh::SshRemoteProcess::IntSignal) {
|
||||||
signalOperation->interruptProcess(executable);
|
signalOperation->interruptProcess(runnable.executable);
|
||||||
} else {
|
} else {
|
||||||
if (killOperation) // We are already in the process of killing the app.
|
if (killOperation) // We are already in the process of killing the app.
|
||||||
return;
|
return;
|
||||||
@@ -326,7 +305,7 @@ void SshDeviceProcess::SshDeviceProcessPrivate::doSignal(QSsh::SshRemoteProcess:
|
|||||||
connect(signalOperation.data(), SIGNAL(finished(QString)), q,
|
connect(signalOperation.data(), SIGNAL(finished(QString)), q,
|
||||||
SLOT(handleKillOperationFinished(QString)));
|
SLOT(handleKillOperationFinished(QString)));
|
||||||
killTimer.start(5000);
|
killTimer.start(5000);
|
||||||
signalOperation->killProcess(executable);
|
signalOperation->killProcess(runnable.executable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
|
class StandardRunnable;
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT SshDeviceProcess : public DeviceProcess
|
class PROJECTEXPLORER_EXPORT SshDeviceProcess : public DeviceProcess
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -37,23 +39,16 @@ public:
|
|||||||
SshDeviceProcess(const QSharedPointer<const IDevice> &device, QObject *parent = 0);
|
SshDeviceProcess(const QSharedPointer<const IDevice> &device, QObject *parent = 0);
|
||||||
~SshDeviceProcess();
|
~SshDeviceProcess();
|
||||||
|
|
||||||
void start(const QString &executable, const QStringList &arguments);
|
void start(const Runnable &runnable);
|
||||||
void interrupt();
|
void interrupt();
|
||||||
void terminate();
|
void terminate();
|
||||||
void kill();
|
void kill();
|
||||||
|
|
||||||
QString executable() const;
|
|
||||||
QStringList arguments() const;
|
|
||||||
QProcess::ProcessState state() const;
|
QProcess::ProcessState state() const;
|
||||||
QProcess::ExitStatus exitStatus() const;
|
QProcess::ExitStatus exitStatus() const;
|
||||||
int exitCode() const;
|
int exitCode() const;
|
||||||
QString errorString() const;
|
QString errorString() const;
|
||||||
|
|
||||||
Utils::Environment environment() const;
|
|
||||||
void setEnvironment(const Utils::Environment &env);
|
|
||||||
|
|
||||||
void setWorkingDirectory(const QString & /* directory */) { } // No such thing in the RFC.
|
|
||||||
|
|
||||||
QByteArray readAllStandardOutput();
|
QByteArray readAllStandardOutput();
|
||||||
QByteArray readAllStandardError();
|
QByteArray readAllStandardError();
|
||||||
|
|
||||||
@@ -74,7 +69,7 @@ private slots:
|
|||||||
void handleKillOperationTimeout();
|
void handleKillOperationTimeout();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual QString fullCommandLine() const;
|
virtual QString fullCommandLine(const StandardRunnable &runnable) const;
|
||||||
|
|
||||||
class SshDeviceProcessPrivate;
|
class SshDeviceProcessPrivate;
|
||||||
friend class SshDeviceProcessPrivate;
|
friend class SshDeviceProcessPrivate;
|
||||||
|
@@ -102,13 +102,12 @@ void QnxAnalyzeSupport::startExecution()
|
|||||||
|
|
||||||
setState(StartingRemoteProcess);
|
setState(StartingRemoteProcess);
|
||||||
|
|
||||||
const QStringList args = QStringList()
|
StandardRunnable r = m_runnable;
|
||||||
<< QtcProcess::splitArgs(m_runControl->runnable().commandLineArguments)
|
if (!r.commandLineArguments.isEmpty())
|
||||||
<< QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, m_qmlPort);
|
r.commandLineArguments += QLatin1Char(' ');
|
||||||
|
r.commandLineArguments
|
||||||
appRunner()->setEnvironment(m_runnable.environment);
|
+= QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, m_qmlPort);
|
||||||
appRunner()->setWorkingDirectory(m_runnable.workingDirectory);
|
appRunner()->start(device(), r);
|
||||||
appRunner()->start(device(), m_runnable.executable, args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxAnalyzeSupport::handleRemoteProcessFinished(bool success)
|
void QnxAnalyzeSupport::handleRemoteProcessFinished(bool success)
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
#include <projectexplorer/kitchooser.h>
|
#include <projectexplorer/kitchooser.h>
|
||||||
#include <projectexplorer/kitinformation.h>
|
#include <projectexplorer/kitinformation.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
|
#include <projectexplorer/runnables.h>
|
||||||
#include <projectexplorer/toolchain.h>
|
#include <projectexplorer/toolchain.h>
|
||||||
#include <qtsupport/qtkitinformation.h>
|
#include <qtsupport/qtkitinformation.h>
|
||||||
#include <utils/portlist.h>
|
#include <utils/portlist.h>
|
||||||
@@ -109,10 +110,10 @@ void QnxAttachDebugSupport::launchPDebug()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString remoteCommand = QLatin1String("pdebug");
|
StandardRunnable r;
|
||||||
QStringList arguments;
|
r.executable = QLatin1String("pdebug");
|
||||||
arguments << QString::number(m_pdebugPort);
|
r.commandLineArguments = QString::number(m_pdebugPort);
|
||||||
m_runner->start(m_device, remoteCommand, arguments);
|
m_runner->start(m_device, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxAttachDebugSupport::attachToProcess()
|
void QnxAttachDebugSupport::attachToProcess()
|
||||||
|
@@ -108,9 +108,12 @@ void QnxDebugSupport::startExecution()
|
|||||||
arguments << QString::number(m_pdebugPort);
|
arguments << QString::number(m_pdebugPort);
|
||||||
else if (m_useQmlDebugger && !m_useCppDebugger)
|
else if (m_useQmlDebugger && !m_useCppDebugger)
|
||||||
arguments = Utils::QtcProcess::splitArgs(m_runControl->startParameters().processArgs);
|
arguments = Utils::QtcProcess::splitArgs(m_runControl->startParameters().processArgs);
|
||||||
appRunner()->setEnvironment(m_runnable.environment);
|
StandardRunnable r;
|
||||||
appRunner()->setWorkingDirectory(m_runnable.workingDirectory);
|
r.executable = processExecutable();
|
||||||
appRunner()->start(device(), processExecutable(), arguments);
|
r.commandLineArguments = Utils::QtcProcess::joinArgs(arguments);
|
||||||
|
r.environment = m_runnable.environment;
|
||||||
|
r.workingDirectory = m_runnable.workingDirectory;
|
||||||
|
appRunner()->start(device(), r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QnxDebugSupport::handleRemoteProcessStarted()
|
void QnxDebugSupport::handleRemoteProcessStarted()
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#include "qnxdeviceprocess.h"
|
#include "qnxdeviceprocess.h"
|
||||||
|
|
||||||
#include <projectexplorer/devicesupport/sshdeviceprocess.h>
|
#include <projectexplorer/devicesupport/sshdeviceprocess.h>
|
||||||
|
#include <projectexplorer/runnables.h>
|
||||||
#include <ssh/sshconnection.h>
|
#include <ssh/sshconnection.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -135,9 +136,10 @@ void QnxDeviceConfiguration::updateVersionNumber() const
|
|||||||
QObject::connect(&versionNumberProcess, SIGNAL(finished()), &eventLoop, SLOT(quit()));
|
QObject::connect(&versionNumberProcess, SIGNAL(finished()), &eventLoop, SLOT(quit()));
|
||||||
QObject::connect(&versionNumberProcess, SIGNAL(error(QProcess::ProcessError)), &eventLoop, SLOT(quit()));
|
QObject::connect(&versionNumberProcess, SIGNAL(error(QProcess::ProcessError)), &eventLoop, SLOT(quit()));
|
||||||
|
|
||||||
QStringList arguments;
|
StandardRunnable r;
|
||||||
arguments << QLatin1String("-r");
|
r.executable = QLatin1String("uname");
|
||||||
versionNumberProcess.start(QLatin1String("uname"), arguments);
|
r.commandLineArguments = QLatin1String("-r");
|
||||||
|
versionNumberProcess.start(r);
|
||||||
|
|
||||||
bool isGuiThread = QThread::currentThread() == QCoreApplication::instance()->thread();
|
bool isGuiThread = QThread::currentThread() == QCoreApplication::instance()->thread();
|
||||||
if (isGuiThread)
|
if (isGuiThread)
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "qnxdeviceprocess.h"
|
#include "qnxdeviceprocess.h"
|
||||||
|
|
||||||
#include <projectexplorer/devicesupport/sshdeviceprocess.h>
|
#include <projectexplorer/devicesupport/sshdeviceprocess.h>
|
||||||
|
#include <projectexplorer/runnables.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
@@ -39,14 +40,13 @@ static int pidFileCounter = 0;
|
|||||||
QnxDeviceProcess::QnxDeviceProcess(const QSharedPointer<const IDevice> &device, QObject *parent)
|
QnxDeviceProcess::QnxDeviceProcess(const QSharedPointer<const IDevice> &device, QObject *parent)
|
||||||
: SshDeviceProcess(device, parent)
|
: SshDeviceProcess(device, parent)
|
||||||
{
|
{
|
||||||
setEnvironment(Environment(OsTypeLinux));
|
|
||||||
m_pidFile = QString::fromLatin1("/var/run/qtc.%1.pid").arg(++pidFileCounter);
|
m_pidFile = QString::fromLatin1("/var/run/qtc.%1.pid").arg(++pidFileCounter);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QnxDeviceProcess::fullCommandLine() const
|
QString QnxDeviceProcess::fullCommandLine(const StandardRunnable &runnable) const
|
||||||
{
|
{
|
||||||
QStringList args = arguments();
|
QStringList args = QtcProcess::splitArgs(runnable.commandLineArguments);
|
||||||
args.prepend(executable());
|
args.prepend(runnable.executable);
|
||||||
QString cmd = QtcProcess::Arguments::createUnixArgs(args).toString();
|
QString cmd = QtcProcess::Arguments::createUnixArgs(args).toString();
|
||||||
|
|
||||||
QString fullCommandLine = QLatin1String(
|
QString fullCommandLine = QLatin1String(
|
||||||
@@ -54,10 +54,10 @@ QString QnxDeviceProcess::fullCommandLine() const
|
|||||||
"test -f $HOME/profile && . $HOME/profile ; "
|
"test -f $HOME/profile && . $HOME/profile ; "
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!m_workingDir.isEmpty())
|
if (!runnable.workingDirectory.isEmpty())
|
||||||
fullCommandLine += QString::fromLatin1("cd %1 ; ").arg(QtcProcess::quoteArg(m_workingDir));
|
fullCommandLine += QString::fromLatin1("cd %1 ; ").arg(QtcProcess::quoteArg(runnable.workingDirectory));
|
||||||
|
|
||||||
const Environment env = environment();
|
const Environment env = runnable.environment;
|
||||||
for (auto it = env.constBegin(); it != env.constEnd(); ++it)
|
for (auto it = env.constBegin(); it != env.constEnd(); ++it)
|
||||||
fullCommandLine += QString::fromLatin1("%1='%2' ").arg(it.key()).arg(it.value());
|
fullCommandLine += QString::fromLatin1("%1='%2' ").arg(it.key()).arg(it.value());
|
||||||
|
|
||||||
@@ -69,9 +69,10 @@ QString QnxDeviceProcess::fullCommandLine() const
|
|||||||
void QnxDeviceProcess::doSignal(int sig)
|
void QnxDeviceProcess::doSignal(int sig)
|
||||||
{
|
{
|
||||||
auto signaler = new SshDeviceProcess(device(), this);
|
auto signaler = new SshDeviceProcess(device(), this);
|
||||||
QString cmd = QString::fromLatin1("kill -%2 `cat %1`").arg(m_pidFile).arg(sig);
|
StandardRunnable r;
|
||||||
|
r.executable = QString::fromLatin1("kill -%2 `cat %1`").arg(m_pidFile).arg(sig);
|
||||||
connect(signaler, &SshDeviceProcess::finished, signaler, &QObject::deleteLater);
|
connect(signaler, &SshDeviceProcess::finished, signaler, &QObject::deleteLater);
|
||||||
signaler->start(cmd, QStringList());
|
signaler->start(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -38,17 +38,14 @@ class QnxDeviceProcess : public ProjectExplorer::SshDeviceProcess
|
|||||||
public:
|
public:
|
||||||
QnxDeviceProcess(const QSharedPointer<const ProjectExplorer::IDevice> &device, QObject *parent);
|
QnxDeviceProcess(const QSharedPointer<const ProjectExplorer::IDevice> &device, QObject *parent);
|
||||||
|
|
||||||
void setWorkingDirectory(const QString &directory) { m_workingDir = directory; }
|
|
||||||
|
|
||||||
void interrupt() { doSignal(2); }
|
void interrupt() { doSignal(2); }
|
||||||
void terminate() { doSignal(15); }
|
void terminate() { doSignal(15); }
|
||||||
void kill() { doSignal(9); }
|
void kill() { doSignal(9); }
|
||||||
QString fullCommandLine() const;
|
QString fullCommandLine(const ProjectExplorer::StandardRunnable &runnable) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void doSignal(int sig);
|
void doSignal(int sig);
|
||||||
QString m_pidFile;
|
QString m_pidFile;
|
||||||
QString m_workingDir;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -27,8 +27,11 @@
|
|||||||
|
|
||||||
#include "qnxdeviceprocess.h"
|
#include "qnxdeviceprocess.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/runnables.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -59,7 +62,9 @@ Slog2InfoRunner::Slog2InfoRunner(const QString &applicationId,
|
|||||||
|
|
||||||
void Slog2InfoRunner::start()
|
void Slog2InfoRunner::start()
|
||||||
{
|
{
|
||||||
m_testProcess->start(QLatin1String("slog2info"), QStringList());
|
StandardRunnable r;
|
||||||
|
r.executable = QLatin1String("slog2info");
|
||||||
|
m_testProcess->start(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Slog2InfoRunner::stop()
|
void Slog2InfoRunner::stop()
|
||||||
@@ -89,9 +94,10 @@ void Slog2InfoRunner::handleTestProcessCompleted()
|
|||||||
|
|
||||||
void Slog2InfoRunner::readLaunchTime()
|
void Slog2InfoRunner::readLaunchTime()
|
||||||
{
|
{
|
||||||
QStringList arguments;
|
StandardRunnable r;
|
||||||
arguments << QLatin1String("+\"%d %H:%M:%S\"");
|
r.executable = QLatin1String("date");
|
||||||
m_launchDateTimeProcess->start(QLatin1String("date"), arguments);
|
r.commandLineArguments = QLatin1String("+\"%d %H:%M:%S\"");
|
||||||
|
m_launchDateTimeProcess->start(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Slog2InfoRunner::launchSlog2Info()
|
void Slog2InfoRunner::launchSlog2Info()
|
||||||
@@ -105,9 +111,10 @@ void Slog2InfoRunner::launchSlog2Info()
|
|||||||
m_launchDateTime = QDateTime::fromString(QString::fromLatin1(m_launchDateTimeProcess->readAllStandardOutput()).trimmed(),
|
m_launchDateTime = QDateTime::fromString(QString::fromLatin1(m_launchDateTimeProcess->readAllStandardOutput()).trimmed(),
|
||||||
QString::fromLatin1("dd HH:mm:ss"));
|
QString::fromLatin1("dd HH:mm:ss"));
|
||||||
|
|
||||||
QStringList arguments;
|
StandardRunnable r;
|
||||||
arguments << QLatin1String("-w");
|
r.executable = QLatin1String("slog2info");
|
||||||
m_logProcess->start(QLatin1String("slog2info"), arguments);
|
r.commandLineArguments = QLatin1String("-w");
|
||||||
|
m_logProcess->start(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Slog2InfoRunner::readLogStandardOutput()
|
void Slog2InfoRunner::readLogStandardOutput()
|
||||||
|
@@ -25,9 +25,14 @@
|
|||||||
|
|
||||||
#include "linuxdeviceprocess.h"
|
#include "linuxdeviceprocess.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/runnables.h>
|
||||||
|
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
|
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace RemoteLinux {
|
namespace RemoteLinux {
|
||||||
|
|
||||||
static QString quote(const QString &s) { return Utils::QtcProcess::quoteArgUnix(s); }
|
static QString quote(const QString &s) { return Utils::QtcProcess::quoteArgUnix(s); }
|
||||||
@@ -36,7 +41,6 @@ LinuxDeviceProcess::LinuxDeviceProcess(const QSharedPointer<const ProjectExplore
|
|||||||
QObject *parent)
|
QObject *parent)
|
||||||
: ProjectExplorer::SshDeviceProcess(device, parent)
|
: ProjectExplorer::SshDeviceProcess(device, parent)
|
||||||
{
|
{
|
||||||
setEnvironment(Utils::Environment(Utils::OsTypeLinux));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinuxDeviceProcess::setRcFilesToSource(const QStringList &filePaths)
|
void LinuxDeviceProcess::setRcFilesToSource(const QStringList &filePaths)
|
||||||
@@ -44,22 +48,19 @@ void LinuxDeviceProcess::setRcFilesToSource(const QStringList &filePaths)
|
|||||||
m_rcFilesToSource = filePaths;
|
m_rcFilesToSource = filePaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinuxDeviceProcess::setWorkingDirectory(const QString &directory)
|
QString LinuxDeviceProcess::fullCommandLine(const StandardRunnable &runnable) const
|
||||||
{
|
{
|
||||||
m_workingDir = directory;
|
const Environment env = runnable.environment;
|
||||||
}
|
|
||||||
|
|
||||||
QString LinuxDeviceProcess::fullCommandLine() const
|
|
||||||
{
|
|
||||||
QString fullCommandLine;
|
QString fullCommandLine;
|
||||||
foreach (const QString &filePath, rcFilesToSource())
|
foreach (const QString &filePath, rcFilesToSource())
|
||||||
fullCommandLine += QString::fromLatin1("test -f %1 && . %1;").arg(filePath);
|
fullCommandLine += QString::fromLatin1("test -f %1 && . %1;").arg(filePath);
|
||||||
if (!m_workingDir.isEmpty()) {
|
if (!runnable.workingDirectory.isEmpty()) {
|
||||||
fullCommandLine.append(QLatin1String("cd ")).append(quote(m_workingDir))
|
fullCommandLine.append(QLatin1String("cd ")).append(quote(runnable.workingDirectory))
|
||||||
.append(QLatin1String(" && "));
|
.append(QLatin1String(" && "));
|
||||||
}
|
}
|
||||||
QString envString;
|
QString envString;
|
||||||
for (auto it = environment().constBegin(); it != environment().constEnd(); ++it) {
|
for (auto it = env.constBegin(); it != env.constEnd(); ++it) {
|
||||||
if (!envString.isEmpty())
|
if (!envString.isEmpty())
|
||||||
envString += QLatin1Char(' ');
|
envString += QLatin1Char(' ');
|
||||||
envString.append(it.key()).append(QLatin1String("='")).append(it.value())
|
envString.append(it.key()).append(QLatin1String("='")).append(it.value())
|
||||||
@@ -69,10 +70,10 @@ QString LinuxDeviceProcess::fullCommandLine() const
|
|||||||
fullCommandLine.append(QLatin1Char(' ')).append(envString);
|
fullCommandLine.append(QLatin1Char(' ')).append(envString);
|
||||||
if (!fullCommandLine.isEmpty())
|
if (!fullCommandLine.isEmpty())
|
||||||
fullCommandLine += QLatin1Char(' ');
|
fullCommandLine += QLatin1Char(' ');
|
||||||
fullCommandLine.append(quote(executable()));
|
fullCommandLine.append(quote(runnable.executable));
|
||||||
if (!arguments().isEmpty()) {
|
if (!runnable.commandLineArguments.isEmpty()) {
|
||||||
fullCommandLine.append(QLatin1Char(' '));
|
fullCommandLine.append(QLatin1Char(' '));
|
||||||
fullCommandLine.append(Utils::QtcProcess::joinArgs(arguments(), Utils::OsTypeLinux));
|
fullCommandLine.append(runnable.commandLineArguments);
|
||||||
}
|
}
|
||||||
return fullCommandLine;
|
return fullCommandLine;
|
||||||
}
|
}
|
||||||
|
@@ -44,15 +44,12 @@ public:
|
|||||||
// Files to source before executing the command (if they exist). Overrides the default.
|
// Files to source before executing the command (if they exist). Overrides the default.
|
||||||
void setRcFilesToSource(const QStringList &filePaths);
|
void setRcFilesToSource(const QStringList &filePaths);
|
||||||
|
|
||||||
void setWorkingDirectory(const QString &directory);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString fullCommandLine() const;
|
QString fullCommandLine(const ProjectExplorer::StandardRunnable &) const override;
|
||||||
|
|
||||||
QStringList rcFilesToSource() const;
|
QStringList rcFilesToSource() const;
|
||||||
|
|
||||||
QStringList m_rcFilesToSource;
|
QStringList m_rcFilesToSource;
|
||||||
QString m_workingDir;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace RemoteLinux
|
} // namespace RemoteLinux
|
||||||
|
@@ -132,12 +132,12 @@ void RemoteLinuxAnalyzeSupport::startExecution()
|
|||||||
connect(runner, &DeviceApplicationRunner::reportError,
|
connect(runner, &DeviceApplicationRunner::reportError,
|
||||||
this, &RemoteLinuxAnalyzeSupport::handleAppRunnerError);
|
this, &RemoteLinuxAnalyzeSupport::handleAppRunnerError);
|
||||||
|
|
||||||
QStringList args = QtcProcess::splitArgs(runnable().commandLineArguments, OsTypeLinux);
|
auto r = runnable();
|
||||||
args.append(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, d->qmlPort));
|
if (!r.commandLineArguments.isEmpty())
|
||||||
|
r.commandLineArguments.append(QLatin1Char(' '));
|
||||||
runner->setWorkingDirectory(runnable().workingDirectory);
|
r.commandLineArguments
|
||||||
runner->setEnvironment(runnable().environment);
|
+= QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, d->qmlPort);
|
||||||
runner->start(device(), runnable().executable, args);
|
runner->start(device(), r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteLinuxAnalyzeSupport::handleAppRunnerError(const QString &error)
|
void RemoteLinuxAnalyzeSupport::handleAppRunnerError(const QString &error)
|
||||||
|
@@ -124,18 +124,25 @@ void LinuxDeviceDebugSupport::startExecution()
|
|||||||
this, &LinuxDeviceDebugSupport::handleRemoteErrorOutput);
|
this, &LinuxDeviceDebugSupport::handleRemoteErrorOutput);
|
||||||
connect(runner, &DeviceApplicationRunner::remoteStdout,
|
connect(runner, &DeviceApplicationRunner::remoteStdout,
|
||||||
this, &LinuxDeviceDebugSupport::handleRemoteOutput);
|
this, &LinuxDeviceDebugSupport::handleRemoteOutput);
|
||||||
|
connect(runner, &DeviceApplicationRunner::finished,
|
||||||
|
this, &LinuxDeviceDebugSupport::handleAppRunnerFinished);
|
||||||
|
connect(runner, &DeviceApplicationRunner::reportProgress,
|
||||||
|
this, &LinuxDeviceDebugSupport::handleProgressReport);
|
||||||
|
connect(runner, &DeviceApplicationRunner::reportError,
|
||||||
|
this, &LinuxDeviceDebugSupport::handleAppRunnerError);
|
||||||
if (d->qmlDebugging && !d->cppDebugging)
|
if (d->qmlDebugging && !d->cppDebugging)
|
||||||
connect(runner, &DeviceApplicationRunner::remoteProcessStarted,
|
connect(runner, &DeviceApplicationRunner::remoteProcessStarted,
|
||||||
this, &LinuxDeviceDebugSupport::handleRemoteProcessStarted);
|
this, &LinuxDeviceDebugSupport::handleRemoteProcessStarted);
|
||||||
|
|
||||||
QStringList args = QtcProcess::splitArgs(runnable().commandLineArguments, OsTypeLinux);
|
StandardRunnable r = runnable();
|
||||||
|
QStringList args = QtcProcess::splitArgs(r.commandLineArguments, OsTypeLinux);
|
||||||
QString command;
|
QString command;
|
||||||
|
|
||||||
if (d->qmlDebugging)
|
if (d->qmlDebugging)
|
||||||
args.prepend(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, d->qmlPort));
|
args.prepend(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, d->qmlPort));
|
||||||
|
|
||||||
if (d->qmlDebugging && !d->cppDebugging) {
|
if (d->qmlDebugging && !d->cppDebugging) {
|
||||||
command = runnable().executable;
|
command = r.executable;
|
||||||
} else {
|
} else {
|
||||||
command = device()->debugServerPath();
|
command = device()->debugServerPath();
|
||||||
if (command.isEmpty())
|
if (command.isEmpty())
|
||||||
@@ -144,16 +151,9 @@ void LinuxDeviceDebugSupport::startExecution()
|
|||||||
args.append(QString::fromLatin1("--multi"));
|
args.append(QString::fromLatin1("--multi"));
|
||||||
args.append(QString::fromLatin1(":%1").arg(d->gdbServerPort));
|
args.append(QString::fromLatin1(":%1").arg(d->gdbServerPort));
|
||||||
}
|
}
|
||||||
|
r.executable = command;
|
||||||
connect(runner, &DeviceApplicationRunner::finished,
|
r.commandLineArguments = QtcProcess::joinArgs(args, OsTypeLinux);
|
||||||
this, &LinuxDeviceDebugSupport::handleAppRunnerFinished);
|
runner->start(device(), r);
|
||||||
connect(runner, &DeviceApplicationRunner::reportProgress,
|
|
||||||
this, &LinuxDeviceDebugSupport::handleProgressReport);
|
|
||||||
connect(runner, &DeviceApplicationRunner::reportError,
|
|
||||||
this, &LinuxDeviceDebugSupport::handleAppRunnerError);
|
|
||||||
runner->setEnvironment(runnable().environment);
|
|
||||||
runner->setWorkingDirectory(runnable().workingDirectory);
|
|
||||||
runner->start(device(), command, args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinuxDeviceDebugSupport::handleAppRunnerError(const QString &error)
|
void LinuxDeviceDebugSupport::handleAppRunnerError(const QString &error)
|
||||||
|
@@ -31,8 +31,6 @@
|
|||||||
#include <projectexplorer/runnables.h>
|
#include <projectexplorer/runnables.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
#include <utils/qtcprocess.h>
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace RemoteLinux {
|
namespace RemoteLinux {
|
||||||
@@ -76,11 +74,7 @@ void RemoteLinuxRunControl::start()
|
|||||||
this, &RemoteLinuxRunControl::handleRunnerFinished);
|
this, &RemoteLinuxRunControl::handleRunnerFinished);
|
||||||
connect(&d->runner, &DeviceApplicationRunner::reportProgress,
|
connect(&d->runner, &DeviceApplicationRunner::reportProgress,
|
||||||
this, &RemoteLinuxRunControl::handleProgressReport);
|
this, &RemoteLinuxRunControl::handleProgressReport);
|
||||||
d->runner.setEnvironment(d->runnable.environment);
|
d->runner.start(d->device, d->runnable);
|
||||||
d->runner.setWorkingDirectory(d->runnable.workingDirectory);
|
|
||||||
d->runner.start(d->device, d->runnable.executable,
|
|
||||||
Utils::QtcProcess::splitArgs(d->runnable.commandLineArguments,
|
|
||||||
Utils::OsTypeLinux));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RunControl::StopResult RemoteLinuxRunControl::stop()
|
RunControl::StopResult RemoteLinuxRunControl::stop()
|
||||||
|
Reference in New Issue
Block a user