Commit Graph

30 Commits

Author SHA1 Message Date
Jarek Kobus
8af62eb256 DeviceProcess: Minimize the usage of DeviceProcess
DeviceProcess doesn't provide any public API, so
replace all usages of it with QtcProcess.
Keep using DeviceProcess only for reimplementations.

Change-Id: I35a14251a81dd0dde426f56ca2e809b527cc863c
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-28 13:10:42 +00:00
Jarek Kobus
6360cffc80 Fix passing environment to remote
After removing Runnable parameter from DeviceProcess::start()
(see 95c9579c58) we are now
setting the runnable's environment to the remote process
directly. This is now used in 2 places:

1. For forming the proper fullCommandLine(), so that
the passed environment is expanded to command line
arguments

2. For running the remote process itself.

Before the mentioned change these two environments were
separated (1st was taken from run environment aspect,
2nd was left with its default value - see SshProcess c'tor).
After the mentioned change 1 and 2 are equal (i.e. both are
env aspect). This affects running app in terminal,
as the aspect env is applied to the stub process, so it
can't start properly.

This change brings the separation back.

Amends 95c9579c58

Change-Id: I5efe82e19d3fb5608f97e56c2f4b7651643e156a
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-02-21 14:21:33 +00:00
hjk
95c9579c58 ProjectExplorer: Normalize DeviceProcess::start() signature
Change-Id: I2915be34d4a1eed64567874dcf0263b7583cc142
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-02-14 15:10:12 +00:00
hjk
e2cb64471a Utils: Move QtcProcess constructor setup data to shared setup data
This includes replacing DeviceProcess terminal handling with base
member.

Change-Id: Id1541bfce33c71dddc71b4816ad0b174dce3879c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-02-11 17:33:48 +00:00
Jarek Kobus
74ea443ebf LinuxDeviceProcess: Remove unused setRcFilesToSource()
Change-Id: Ica834cbecfa481a3a6c94519a9799c4b917d49a1
Reviewed-by: hjk <hjk@qt.io>
2022-01-31 09:33:57 +00:00
hjk
52e5023bcc ProjectExplorer: Use Utils::CommandLine in ProjectExplorer::Runnable
Change-Id: Id965f1f9047dcbc3ea5c9ddaa550d12668cf8ae6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-13 15:04:30 +00:00
hjk
4a42bcd4e8 Utils/ProjectExplorer: Use FilePath for Runnable::workingDirectory
... and in some using code.

Change-Id: I231ea56628908f7d305d13f07eabe8803fe8a791
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-06 12:51:24 +00:00
Christian Kandeler
30d4f7b48c RemoteLinux: Make remote process PID parsing more robust
- Do not assume that the PID string is the first output.
- Do not assume output has already been read when the process finishes.

Fixes: QTCREATORBUG-25306
Change-Id: Ia7cec6113e7f86469da2e6e0c62e08b38213093a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2021-02-09 10:05:23 +00:00
Christian Kandeler
6d3f236aab Utils::Environment: Use expanded values
The Environment class is supposed to support values with references to
other variables, but we failed to actually expand them in most places.

Fixes: QTCREATORBUG-22687
Change-Id: I108cb59d3b4571471423455240f6f4f1cf64bf05
Reviewed-by: hjk <hjk@qt.io>
2019-08-20 12:39:16 +00:00
hjk
1396c6e8e9 ProjectExplorer: Use Utils::FileName for Runnable::executable
Change-Id: I584bc18aa19a4c9886af7b13e95052dfd4350b34
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-06-21 10:32:31 +00:00
hjk
611e1ea837 Utils: Encourage marking of raw command line parameters
Change-Id: Id66ac07732c66ab8c1232fe1f58042de8a61abb0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-06-06 12:22:47 +00:00
hjk
2591d02fef RemoteLinux: Use Util::CommandLine to construct device process commands
Change-Id: I194b5225f56cabd92e1de7d3df2e74b515aa476e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-06-05 13:03:47 +00:00
Christian Kandeler
6fa474ead8 Fix "open terminal with environment" functionality
... for RemoteLinux. We now open a *remote* terminal, as we should.

Change-Id: I84f73bbfcb6132717a30f5ef7c8d9d56d854a609
Reviewed-by: hjk <hjk@qt.io>
2019-05-24 09:10:39 +00:00
hjk
164ae1428e ProjectExplorer: Move RunControl related classes to separate file pair
Change-Id: I5da56f80336673d595907abcc797f628be680cd5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-03-13 14:44:46 +00:00
Ulf Hermann
4b5841292e LinuxDeviceProcess: Only look for processId on freshly started process
There may be additional output being retrieved after the process is
finished. We don't want that to get mangled by the processId mechanism.

Change-Id: I9ad3146ace66288de1a4d8f1e94b9999719862c8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-02-12 13:11:17 +00:00
Ulf Hermann
95fc74ac52 RemoteLinux: Fix some line breaks
Change-Id: I11e13bc05be366c9dd1eb5449fc395c3098c012a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-15 17:23:13 +00:00
Christian Kandeler
8a2327068e RemoteLinux: Support terminal aspect
This is possible now that the remote process is started via a local
tool.

[ChangeLog] Remote Linux applications can be run in a terminal now.

Change-Id: I9f7df87563a18880d85c6d16ad18fb10a4d9f0e0
Reviewed-by: hjk <hjk@qt.io>
2019-01-11 10:13:52 +00:00
hjk
36b835ff0a Finish merging Runnable and StandardRunnable
As all Runnables are known to be StandardRunnables, this here
essentially replaces all .is<StandardRunnable> by 'true'.
.as<StandardRunnable> by no-op, and fixes the fallout.

Change-Id: I1632f8e164fa0a9dff063df47a9e191fdf7bbb2e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-05-23 08:48:36 +00:00
hjk
68867a8a62 ProjectExplorer: Start merging Runnable and StandardRunnable
With AndroidRunnable gone, there is only one incarnation of
a Runnable left - the StandardRunnable.

It is not expected to ever need a different runnable again,
as platform differences are now handled in the platform specific
RunConfigurations and RunWorkers created there locally, and
global information is typically communicated via
RunConfigurationAspects, so there is no point in keeping the
Runnable::{Concept,Model} machinery.

This patch here essentially makes StandardRunnable a type alias
for Runnable, to allow downstream changing all

  if (r.is<StandardRunnable>()) { ... r.as<StandardRunnable>(); }

one by one.

When all downstream is adjusted, the alias can go completely.

Change-Id: I86aa92c7fae8d54ca603484b7e1746c126b0bddb
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-05-22 08:24:46 +00:00
Nikita Baryshnikov
e4c3e04ebd Environment: make usage of Environment.iterators more consistent
Change-Id: I114ddb2238ad19ac0681b8405925f283f2460f21
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-28 08:59:55 +00:00
Ulf Hermann
0bef62481b RemoteLinux: Allow killing processes by ID
Killing every process on the system that happens to have the same name
as the one we've started is error prone and dangerous. We might kill
processes we haven't started and other processes might rename
themselves at runtime so that we don't find them anymore.

The process ID is obtained by outputting it as very first thing on
stdout and then starting the process with "exec", so that it isn't
forked.

Change-Id: Icc51bd1968afc47f4dc42f9e90e5dcbd0b1e40a7
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-04-22 08:50:39 +00:00
hjk
58be2708a3 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>
2016-01-28 13:27:30 +00:00
Tobias Hunger
397e7f4843 Update License according to agreement with Free Qt Foundation
* Update files in src/plugins

Change-Id: Ia5d77fad7d19d4bb3498e78661982f68729adb22
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-19 15:57:01 +00:00
Eike Ziller
3c85058694 Update License
Change-Id: I711d5fb475ef814a1dc9d2822740e827f3f67125
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
2015-01-16 12:37:56 +01:00
Eike Ziller
8295b503be License update
Change-Id: I3c22ef2685d7aa589f5d0ab74d693653a4c32082
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
2014-10-09 11:41:44 +02:00
Christian Kandeler
da85540971 LinuxDeviceProcess: Quote environment variable values.
The current code breaks for values that contain spaces.

Change-Id: Ia2a318dcac09a8d1c1ce368378a33c633f28bf49
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-05-08 09:37:32 +02:00
hjk
c68ebeed2e QtcProcess: Introduce a QtcProcess::Arguments class
This is used to get a platform-agnostic handle on "command line
arguments". It essentially wraps a single QString on Windows,
and a QStringList everywhere else.

As a consequence, several occurrences of #ifdef Q_OS_*
can be removed from the codebase.

Change-Id: Ic93118c1bd0bce0ebb58f416d395dbaebb861772
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2014-02-19 09:19:28 +01:00
Robert Loehning
746c5d8863 Incremented year in copyright info
Change-Id: Ib5423fdd064e4546f848c0b640b0ed0514c26d3a
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2014-01-08 08:29:47 +01:00
Frank Osterfeld
9ef0b75e88 Use POSIX-compliant "." instead of "source"
Using "source" to source a script isn't defined by POSIX sh, while "."
is. Using the more portable "." makes it work with QNX's sh.

Change-Id: I948fc562c62789184553d57b949697c2525771f3
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
2013-10-10 13:40:16 +02:00
Christian Kandeler
22599094b0 Introduce the concept of a "device process".
Provide a QProcess-like abstraction that can be used
to implement processes running locally or on a remote
device. Objects of a concrete class implementing the functionality
are created by IDevice objects.
Current implementations are:
     - Local execution (QProcess-based), provided via the DesktopDevice.
     - Remote execution via SSH.
     - A specialized case of the former for remote Linux systems (provided by
       LinuxDevice).
The latter is already being used in a number of places. As a result, lots of
code dealing with details such as setting the remote environment could be
moved to a central location. These things are no longer the concern of whoever
is wishing to run a remote process.

Change-Id: I919260ee6e77a020ca47226a4a534e7b8398106f
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-08-19 16:13:21 +02:00