SshDeviceProcess::start() is overridden and it starts
connecting phase. It marks the current state as
Starting. Later, when connection is being established,
it calls back the base QtcProcess::start() and it
fails on assert. This doesn't happen when starting
not in terminal, as in this case SshDeviceProcess
delegates the start to the aggregated SshRemoteProcess
instead of calling QtcProcess::start().
Disabling the assert for a while, until we de-virtualize
the public interface back again, as from the public
API side it's still a valid assert.
Change-Id: I0d62ec0db778f68fcc5afa4a6f08d54f98d74e4f
Reviewed-by: hjk <hjk@qt.io>
Add an info to the start process log about whether it was
started by a call to QtcProcess::runBlocking() or not.
In case it was, specify the event loop mode.
Change-Id: Ie1adf0526b341eedcd0d84505075a942b057ff99
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Since the input data may have changed in meantime.
Ensure we are not running when restarting the process.
Change-Id: I79a515b3c0526a6315027433fd821698fb2c6e94
Reviewed-by: hjk <hjk@qt.io>
Get rid of program and arguments parameters from
start() method. Get rid of customStart() and isCustomStart()
methods. Provide a default implementation for start() method.
Introduce virtual doDefaultStart() method, to be called when
default implementation for start() is used() - it's being
triggered by a call to defaultStart(). When some implemetation
provides the custom implemetation of start() method
(e.g. TerminalImpl), the doDefaultStart() may stay unimplemented
(won't be called).
Rename WrongFileNameFailure to WrongCommandFailure, as that's
being used also in case when command arguments parsing failed.
Cleanup some unimplemented or unused fields of ProcessLauncherImpl.
Change-Id: I87661e9838dc30888034b2fa62d47c861bf8f9dd
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Don't pass writeData, as that's available through
ProcessSetupData.
Change-Id: Ic55b21c6a3338168ee251bcc1c57594f50c52d2f
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Don't share the same instance of data with the QtcProcess
itself, as some of the fields needs to be modified just
for the starting purposes. In this way we avoid cyclic
modifications of the original data on subsequent runs.
Change-Id: I937978ee92f848d247025939ac5b0c6c60c29ff7
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Use Utils::Environment for of environment.
Use Utils::FilePath for workingDirectory.
Change-Id: I6b717139f8ff7ddbd629fb22cf816b2303fb5e6a
Reviewed-by: hjk <hjk@qt.io>
This includes replacing DeviceProcess terminal handling with base
member.
Change-Id: Id1541bfce33c71dddc71b4816ad0b174dce3879c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
I'd really like to keep/re-enable at least the terminal use
as kind of property not directly tied to the QtcProcess object
life time.
This here is a first step towards this goal (and only a sketch)
I am not sure whether I like using a pointer to a "parent"
data struct as a means to propagate data, but it works, and
it's easy to add a new data item without touching all lower levels.
Change-Id: Ice2d3246951438a14383b097f307fd61306c29db
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
There is no need for TerminalRunner::setRunAsRoot()
as debugger is already being run as root.
Implement runAsRoot for non-terminal QtcProcess, too.
Fixes: QTCREATORBUG-26964
Change-Id: Id5110db86b7b809a5608714464241cee73875f2b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
We'll need a lot of combinations.
Change-Id: Ic92ad6fba1d96c42571be76f7c24b253f210b132
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Remove SshRemoteProcessRunner::runInTerminal() method,
it wasn't used anywhere (just in test).
Remove QtcProcess::useTerminal, as process should be
created in TerminalOn mode when there is a need for terminal.
Add a parameter to
SshRemoteProcess::fullLocalCommandLine(bool inTerminal)
as this may still be needed when running application
through ssh from terminal (ssh -tt option).
Change-Id: I71911082fcca190b82a1106a2ca1ca48dc5d4c79
Reviewed-by: hjk <hjk@qt.io>
(cherry picked from commit 95a9b22f6f)
Introduce EventLoopMode enum and pass it to the
QtcProcess::runBlocking() instead. There is no need to
store this setting. By default this value is NoEventLoop.
Change-Id: Icad98b77bec5280b79039b7e5aa4ec408261521c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Adapt all callers' code so that it passes the FilePath
instead of QString. As a consequence introduce
TemporaryDirectory::masterDirectoryFilePath() and use
it where easily possible.
Change-Id: I14564949b3b916921e32a2957c84c03d1da43af2
Reviewed-by: hjk <hjk@qt.io>
It may apparently happen that when calling QProcess::start()
we may receive a synchronous signal QProcess::errorOccurred()
from the process we are trying to start. In this case
the handler of the error signal might have removed the
process from m_processes hash, which invalidated the
"Process *& process" reference inside
LauncherSocketHandler::handleStartPacket(). So, using
process reference after calling start() may be dangerous.
Refactor ProcessStartHandler so that it stores the pointer
to the process it handles. The pointer to the handler
should still be valid after calling start(), since
the process itself is being deleted with a delay.
Make ProcessStartHandler a member of ProcessHelper. In this
way it's being reused in QProcessImpl and ProcessLauncher.
Fixes: QTCREATORBUG-26726
Change-Id: I8e3f39953035d76c83bbbb13bd78e3042ba2a14e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Still trying to ramp down non-QtcProcess interfaces.
Change-Id: I6b4ae6788f5021959ff3eb35bbade2157a6d67fa
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Before the m_startFailure flag was used to detect the case
when the process failed to start because of wrong filename.
As this flag was set on any possible error we have always
detected the wrong filename case. Replace this flag with a
new enum describing various start failures.
Don't report again the crashed message. Check if we have already
reported the stop and we don't report it again. The
processExited() handler is being called twice: directly from
localGuiProcessError() and through the delayed localProcessDone().
Fixes: QTCREATORBUG-26467
Change-Id: I3cc6aa0c0b702256cefd77ba95793cd31e82ae10
Reviewed-by: hjk <hjk@qt.io>
These two objects are only used when QtcProcess::runBlocking()
with m_processUserEvents option set is called, otherwise
they are unused. Create them only when they are needed.
This also solves the issue that these two QObjects were not
moved together with QtcProcess when it was moved to another
thread.
Change-Id: I7de6a92a51fc249184fc5811dac7a7bbf05d351f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
The goal is to make a QtcProcess incl. environment, working directory,
executable and arguments testable, e.g. in a terminal. The new
toStandaloneCommandLine() returns a string containing the command line
for a call of "env" the data of the QtcProcess instance as parameters.
To be used like:
qDebug().noquote() << qtcProc.toStandaloneCommandLine();
..and the debug output can be pasted into a terminal.
Change-Id: Ib6cbea290e1eff3279d6e0a67076a624312af879
Reviewed-by: hjk <hjk@qt.io>
There was already a similar function taking a QString.
After that, the remaining no-argument version of absolutePath()
can be deprecated.
Change-Id: I5b9ad8c8b68a5723891b0aa9f5a37e90db0fe09e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reuse ProcessReaper inside process launcher.
Automatically reap all internal QProcesses of QtcProcess
(either direct child of QtcProcess in QProcessImpl
or indirectly inside process launcher).
Make ProcessReaper work again on QProcess instead of on
QtcProcess, so it may still be reused for non-QtcProcesses.
Change-Id: I950cac5cec28f17ae97fe474d6a4e48c01d6aaa2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Sometimes after creating QtcProcess we move it into a different
thread. In this case we should move all the children, too.
Without parent-child relation all the children will stay in the
old thread.
Change-Id: Ibde44d6153092a155dd2d200a7116a046910dddc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Measure it on demand. The printout will appear when
QTC_MEASURE_PROCESS env variable is set. It may be easily
combined with QTC_USE_QPROCESS to compare the time spent
on freezing Creator when starting Creator or when loading
a big project, like Creator project.
In order to compare the measurement between
old implementation (using directly QProcess) and
new implementation (using process launcher) of QtcProcess
do the following (linux):
1. To measure the new implementation:
QTC_MEASURE_PROCESS= ./bin/qtcreator
2. To measure the old implementation:
QTC_USE_QPROCESS= QTC_MEASURE_PROCESS= ./bin/qtcreator
How to measure (two scenarios, A and B):
A. Launch Creator (don't load any project), wait a bit
until all processes finished. Look for the last value
in the 11th column ([A/M] Total Measurement, A means
all measured functions, M means in main thread only).
This value has the greatest influence on GUI freeze -
the higher it is, the longer the GUI is frozen.
Measure it with 1. (new) and 2. (old) implementation
and share your results.
B. Launch Creator and load a Creator project.
Wait until all processes finished (taskbar should be empty).
Look for the last value in the 11th column.
Measure it with 1. (new) and 2. (old) implementation
and share your results.
C* (Additional one)
If only you notice that launching a certain QtcProcess takes
suspiciously too long, replay your scenario that triggers
this process with 1. and 2. and share your results of
the 11th column.
Change-Id: I549c0a9fd0b3d6223f3d27288130553d99ab768e
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Instead of returning a pointer to LauncherSocket instance,
which might get deleted in meantime of just after,
route all calls to the LauncherSocket through the LauncherInterface.
Make all calls to LauncherInterface secured by the
instance mutex.
Change-Id: I751228de5f4263112471098ee08cc73a5245147e
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>