From 162d551455ff87fbefc9da34f6e27c918433bd62 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 12 Apr 2021 17:45:07 +0200 Subject: [PATCH] ProjectExplorer: Allow a device to declare that empty commands are fine Docker allows to run a container "by itself", not needing an explicit command line. Change-Id: I4f3992410f7f7bbcce1897a7400628ef9354043d Reviewed-by: Christian Kandeler Reviewed-by: Alessandro Portale --- src/plugins/projectexplorer/applicationlauncher.cpp | 2 +- src/plugins/projectexplorer/devicesupport/idevice.cpp | 11 +++++++++++ src/plugins/projectexplorer/devicesupport/idevice.h | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/applicationlauncher.cpp b/src/plugins/projectexplorer/applicationlauncher.cpp index 37a707968a8..5ca295f3733 100644 --- a/src/plugins/projectexplorer/applicationlauncher.cpp +++ b/src/plugins/projectexplorer/applicationlauncher.cpp @@ -419,7 +419,7 @@ void ApplicationLauncherPrivate::start(const Runnable &runnable, const IDevice:: return; } - if (runnable.executable.isEmpty()) { + if (!device->isEmptyCommandAllowed() && runnable.executable.isEmpty()) { doReportError(ApplicationLauncher::tr("Cannot run: No command given.")); setFinished(); return; diff --git a/src/plugins/projectexplorer/devicesupport/idevice.cpp b/src/plugins/projectexplorer/devicesupport/idevice.cpp index f4c4904efb6..d3015b1dacc 100644 --- a/src/plugins/projectexplorer/devicesupport/idevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/idevice.cpp @@ -152,6 +152,7 @@ public: Utils::PortList freePorts; QString debugServerPath; QString qmlsceneCommand; + bool emptyCommandAllowed = false; QList deviceIcons; QList deviceActions; @@ -189,6 +190,16 @@ void IDevice::openTerminal(const Utils::Environment &env, const QString &working d->openTerminal(env, workingDir); } +bool IDevice::isEmptyCommandAllowed() const +{ + return d->emptyCommandAllowed; +} + +void IDevice::setAllowEmptyCommand(bool allow) +{ + d->emptyCommandAllowed = allow; +} + IDevice::~IDevice() = default; /*! diff --git a/src/plugins/projectexplorer/devicesupport/idevice.h b/src/plugins/projectexplorer/devicesupport/idevice.h index c3caaa617ff..9e046ac14ca 100644 --- a/src/plugins/projectexplorer/devicesupport/idevice.h +++ b/src/plugins/projectexplorer/devicesupport/idevice.h @@ -221,6 +221,9 @@ public: bool canOpenTerminal() const; void openTerminal(const Utils::Environment &env, const QString &workingDir) const; + bool isEmptyCommandAllowed() const; + void setAllowEmptyCommand(bool allow); + protected: IDevice();