Remove setCreateProcessArgumentModifier() from the ProcessInterface
API and replace it with belowNormalPriority flag.
Change-Id: I6bcb92e56c3a68af7fa3e3a1c8b8eb13e3a2e5a7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
This patch needs to be applied together with the parent change.
There are 3 basic cases:
1. The user doesn't write anything to the write channel:
You don't need to call closeWriteChannel manually anymore.
By default the QtcProcess you create is in ProcessMode::Reader mode.
Internally it opens the process in ReadOnly mode and
closes the write channel just after starting.
2. The user writes some initial data (after being started)
and then closes the write channel:
All what is needed now it to set the write data
(QtcProcess::setWriteData) before calling start.
You also use the default ProcessMode::Reader mode.
Internally it opens the process in ReadWrite mode
and writes the writeData asynchonously when the process
already started. After writing the data it closes the
write channel automatically.
3. The user writes the data also after calling start.
All you need now is to create a process with
ProcessMode::Writer mode. In this mode the write
channel is not closed.
Internally it opens the process in ReadWrite mode
as some writers also read the data from the process.
All the code base is adapted here to the above rules.
Change-Id: Id103019d1d71a3012fd1eade226fe96b9aaa48c2
Reviewed-by: hjk <hjk@qt.io>
Don't base process token on instance pointer,
as it may happen that the recreated instance may
get the same token again (it happens often when invoking
a function that recreates QtcProcess in sequence).
The consequence may be that on the project launcher side
we may reuse the old process (with possibly broken state)
instead of creating a new one.
Change-Id: I8274691f88ae0eefe008746d944a26f29979bf72
Reviewed-by: hjk <hjk@qt.io>
The internal handling of output gets in the way when trying
to read output from a process synchronously.
Make usage of the internal one instead of relying on the
original output handling.
Fixes: QTCREATORBUG-25958
Change-Id: Ie96b5e8d17799a613ff15a52a23a8bdc31cb2939
Reviewed-by: hjk <hjk@qt.io>
Provide way to clean QtcProcess environment which is needed as
e.g. toolchains, build tools, and debugger otherwise run
inside a wrong environment when using docker exec for the
respective process calls.
Change-Id: Ia6de1c90f2134fce260d293a2f6937ab3cfca2ce
Reviewed-by: hjk <hjk@qt.io>
So that this doesn't only apply to runBlocking()
Change-Id: I6ef7c72e13a5e214c7476ede942662a9893c843c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Move launcher process into a separate thread.
Implement blocking API by using wait condition
on the caller's side. Replay all collected
signals from the launcher's thread when leaving
waitingFor* state. In case we were not waiting
for anything deliver the signals asynchronously
from launcher's thread to the caller's thread.
Change-Id: Id44fe5f7ceaac407004984a1dfb6ea65f197d297
Reviewed-by: hjk <hjk@qt.io>
Implement the reply confirmation for the started signal.
After qtcreator_processlauncher starts a new process
we connect to its started() signal and post a reply through
the socket to the LauncherInterface with the information about
the new PID. ProcessLauncherImpl now emits the started signal
with a delay, just after the confirmation has been received.
Change-Id: I2689e8e97b17466bd1f6b32c01909c12d80fcdef
Reviewed-by: hjk <hjk@qt.io>
By default QProcess::readChannel() returns StandardOutput,
and since no one modifies it, it will always be the same.
No need for an assert.
Change-Id: Id55f75e5cce4f1b8eaef2ec3094d7b103c2f0238
Reviewed-by: hjk <hjk@qt.io>
Mark ProcessLauncherImpl canceled when the kill
request has been sent to the process launcher.
If ProcessLauncherImpl is canceled, ignore the
finished reply sent from process launcher.
Recheck the state inside stopProcess() method
after calling terminate() - in this way in case of
ProcessLauncherImpl we avoid calling unimplemented
waitForFinished().
Change-Id: Ibad148f6c7e63ef619e53eb41bbeeb7693be3d25
Reviewed-by: hjk <hjk@qt.io>
The initial implementation is a copy of QbsProcess
with some small adaptations. Start a LauncherProcess
in Creator's main function, just after the creation of
the application object.
Change-Id: I016df3ed664d7914c73f4a35742d5a63d5faaca0
Reviewed-by: hjk <hjk@qt.io>
Abstract part of QProcess interface into ProcessInterface
pure virtual class. The current API of ProcessInterface
is a part of QProcess API used currently to implement
QtcProcess. Provide 2 implementations for it: QProcessImpl
which uses QProcess and ProcessLauncherImpl which is currently
empty implementation with assertions that no method is being
called. Provide an additional switch to QtcProcess c'tor
for selecting the preferred implementation, by default it
selects QProcessImpl. This change doesn't influence any behavior.
Change-Id: Ia5328401affe127f3d36870be8478202d4143480
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Keep SynchronousProcess as type alias for a transition period.
Change-Id: I2540b6cecc17eb46f40ed57d27589011693728f1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
To QtcProcess, as penultimate step to fully merge the two.
Change-Id: Iaab3bc3e50165f732838335bd185632f33a97900
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
- Pass everything through the codec.
- Always emit even incomplete last lines when the process finishes.
- Don't store raw output when line-wise processing is requested.
Change-Id: I5cc30ad0d7ab79387bfb00b48ff957468a1bd004
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Mid-term plan is to concentrate on use of QtcProcess::result()
instead which is a bit more system-agnostic.
There's quite a bit of potential for downstream cleanup by
re-using QtcProcess::exitMessage() now.
Change-Id: I3806b3f5933d96e64b7cfb18cc6c52823fddcbcd
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
The m_process member is strictly speaking only needed for processes
handled "fully locally", i.e. without diversion through any device.
Better set it only when needed, even if only to avoid even unused
locally illegal paths like "docker://123/tmp/x" as working directory.
Change-Id: Ia9e686855ff0c213eb3be03def8c4cecc7ee37ae
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Complains about template argument (QString) and type of value
(const QString) not being the same.
make_optional is usually used with template parameter deduction anyhow,
but in this case we can just return the value.
Change-Id: Icc5c6bb4505d09ab6a864fb7a7c6ec97e34b42b7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>