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 <christian.kandeler@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
hjk
2021-04-12 17:45:07 +02:00
parent c4631271d4
commit 162d551455
3 changed files with 15 additions and 1 deletions

View File

@@ -419,7 +419,7 @@ void ApplicationLauncherPrivate::start(const Runnable &runnable, const IDevice::
return; return;
} }
if (runnable.executable.isEmpty()) { if (!device->isEmptyCommandAllowed() && runnable.executable.isEmpty()) {
doReportError(ApplicationLauncher::tr("Cannot run: No command given.")); doReportError(ApplicationLauncher::tr("Cannot run: No command given."));
setFinished(); setFinished();
return; return;

View File

@@ -152,6 +152,7 @@ public:
Utils::PortList freePorts; Utils::PortList freePorts;
QString debugServerPath; QString debugServerPath;
QString qmlsceneCommand; QString qmlsceneCommand;
bool emptyCommandAllowed = false;
QList<Utils::Icon> deviceIcons; QList<Utils::Icon> deviceIcons;
QList<IDevice::DeviceAction> deviceActions; QList<IDevice::DeviceAction> deviceActions;
@@ -189,6 +190,16 @@ void IDevice::openTerminal(const Utils::Environment &env, const QString &working
d->openTerminal(env, workingDir); d->openTerminal(env, workingDir);
} }
bool IDevice::isEmptyCommandAllowed() const
{
return d->emptyCommandAllowed;
}
void IDevice::setAllowEmptyCommand(bool allow)
{
d->emptyCommandAllowed = allow;
}
IDevice::~IDevice() = default; IDevice::~IDevice() = default;
/*! /*!

View File

@@ -221,6 +221,9 @@ public:
bool canOpenTerminal() const; bool canOpenTerminal() const;
void openTerminal(const Utils::Environment &env, const QString &workingDir) const; void openTerminal(const Utils::Environment &env, const QString &workingDir) const;
bool isEmptyCommandAllowed() const;
void setAllowEmptyCommand(bool allow);
protected: protected:
IDevice(); IDevice();