This is fully controlled by QtcProcess itself, so provide
general implementation of state() inside QtcProcess.
Task-number: QTCREATORBUG-27358
Change-Id: Id6f0b771ed933f870b80d6856c6d94896f946516
Reviewed-by: hjk <hjk@qt.io>
It should be useful when reimplementing ProcessInterface.
It replaces 4 virtual methods with just 1.
Task-number: QTCREATORBUG-27358
Change-Id: I2dafbfbc25f8f016ff2aa19c1a176335a4a7498c
Reviewed-by: hjk <hjk@qt.io>
AbstractProcessStep::slotProcessFinished() slot is connected
to m_process finished() signal. We call there
AbstractProcessStep::Private::cleanUp(), and that calls
m_process.reset(), so it invokes m_process d'tor directly.
SshRemoteProcessRunner::handleProcessFinished() slot is
connected to d->m_process finished() signal. We call there
SshRemoteProcessRunner::setState(), and that calls
d->m_process.reset(), so it invokes m_process d'tor directly.
Delete later m_process instead in both cases.
Change-Id: I4a0f2a631b676b57e8bcc3a7878620bc76dc74de
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Introduce QtcProcess::done() signal. It's similar to
QtcProcess::finished() signal, but also emitted when
process failed to start (so after QProcess::FailedToStart
error occurred).
SshRemoteProcess::finished() signal was already behaving
like this. So, we remove special handling of
FailedToStart error in this class and connect all clients
of SshRemoteProcess to done() signal, instead of finished().
Task-number: QTCREATORBUG-27232
Change-Id: If4240e2172f3f706e812bca669a1d5b24bdc3285
Reviewed-by: hjk <hjk@qt.io>
It's internal method, not meant to be used outside.
It's only used in case of FailedToStart error.
Remove it also from ProcessInterface.
Leave it inside DefaultImpl and its subclasses only.
Remove m_errorString field from ProcessSetupData.
Change-Id: Ie605b95c2ff605ab1259045f1a5b16049207c1d3
Reviewed-by: hjk <hjk@qt.io>
Calling QtcProcess::terminate() after disconecting from
process signals is a task for implicit ProcessReaper.
Delete the process instead.
Change-Id: I02d9b892125b1a1053aefe8edbc7bc96bac41381
Reviewed-by: hjk <hjk@qt.io>
By adding two leading newlines we separate it nicely
from the other part of the test log.
Amends 66c5b1e11e
Change-Id: Ic260cdc4cc2421ddb04bc5027082521800b268e8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Make the test depend on environment variables and give some
hint how to run the test correctly.
Beside this make the test work on Windows and share the setup
with ssh unit test.
Change-Id: I6bbf1ec863449512646ca2c51d13fec537beedbc
Reviewed-by: hjk <hjk@qt.io>
At some point QtcProcess::start() started to be virtual,
so the intention is that SshRemoteProcess overrides it.
Amends 95c9579c58
Change-Id: Iff0c0984f07440c58c5f89a0f5e188503756d6d0
Reviewed-by: hjk <hjk@qt.io>
Make the API more similar to QtcProcess API.
Rename signals to started() and finished().
Change-Id: I01f3a148749b666b8f145d8769222a234ccc9bce
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This includes replacing DeviceProcess terminal handling with base
member.
Change-Id: Id1541bfce33c71dddc71b4816ad0b174dce3879c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
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)
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>
At the cleanup() method we must remove connection from the m_connection
list to avoid access to the freed memory from the
removeInactiveConnections() that caused Qt Creator crash.
Change-Id: I8195f05e903819e3e3b48b2f72fd71047c5a1636
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Removes qmake as a build system for building Qt Creator itself.
Keep them for some tests that are not completely moved to CMake yet.
Change-Id: I846c6ef65626b6dfae6375fdc85d00677aa8c2fb
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Implementation of remote file API for correct FilePath
work with RemoteLinux.
Added tests for this functionality
Run ssh shell in separate thread.
The linux device instance keeps its own thread for running
SshRemoteProcess. In this way all calls to filepath
interface of linux device coming from different threads
are executed in one thread (SshRemoteProcess is reentrant,
but not thread safe). The redirection to the device thread
is done by invoking SshRemoteProcess' methods through
BlockingQueuedConnection.
Done-by: Artem Sokolovskii
Change-Id: Id8756738d3a4597f175c8ef000c148d0c8536eeb
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
When we are starting master process for ssh (-M option specified)
we don't know whether everything went fine, since the process
just starts and doesn't print anything to the output in case
all went fine. It may also happen that when there are issues
the master process finishes soon after it was started.
When everything went fine the master process should create
a socket (specified by ControlPath option). But when we
receive a started() signal from the process, the socket
isn't yet ready. So, in order to detect that connection was
established properly, the old implementation created a
FileSystemWatcher on the expected socket file to appear.
There are 2 issues with the approach above:
1. There might be a race condition inside the started()
handler of the master process. After checking that
the expected socket isn't created yet and before setting
up the file system watcher, the socket file could have
been created in meantime what wouldn't be noticed.
2. The use of Utils::FileSystemWatcher excludes the usage
in non-main threads. Thus in general: usage of SshConnection
outside of main thread is dangerous.
This patch implements it in a different way. Instead of
installing a file system watcher we make use of local command
of ssh master process. We enable it by "PermitLocalCommand=yes"
and specify a local command by "LocalCommand=echo". This means
that local command will be executed after successfully connecting
to the server. Our command is very simple - just empty echo,
which means that we should expect the "\n" on master process
output after successful run. So, instead of connecting to
started() signal we are connected to readyReadStandardOutput()
and detect successful connection after receiving newline char.
This eliminates both issues with the old approach and makes a
step towards thread safe shared ssh connections.
Change-Id: I2e20c82aeff09b297e3cad5644d4d2c956db82d0
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>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
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>