Change the last arg to std::chrono::milliseconds type.
Change-Id: Ifb818f76ee33e03997cb5b1dd17336248f401238
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Add an extra arg to runBlocking() function instead.
Use std::chrono::seconds for timeout.
Change-Id: I7c3c21e8f26a2ccbed157d15083d6ef0b4cd2f7e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Rename ProcessResult::Hang into Canceled.
Change the behavior of the Process:
Whenever the terminate() or kill() is called, including
indirect calls through stop() or runBlocking()'s timeout,
mark the process result as Canceled.
In this way the Process running by a call to start()
may also finish with Canceled state. Before it was only
happening for processes started via runBlocking().
Adapt the runBlockingStdOut_data() test accordingly.
Get rid of ProcessInterface::m_canceledByUser field.
Use ProcessResult::Canceled state instead.
Fix existing 3 usages of m_canceledByUser field.
Use standarized exitMessage() method for them.
Add automatic measurement of process execution.
Introduce processDuration() getter.
Use it for reporting exitMessage() instead of timeoutS().
Change-Id: I1a68559ce844caef863a97a6b0577b0238011f70
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Extract the common part of handling the timeout into the
handleTimeout lambda.
Change-Id: I3c55c76cbc3d1217322c1b2a7002285bf2e649d3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
The setter setTimeoutS() is going to be removed soon.
It's going to be replaced by the extra arg to runBlocking().
Change-Id: I60b8c952ba5e27e36183f8652aaa92059e08746e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
It was only needed for runBlocking() in event loop mode.
Handle it locally from the runBlocking() function.
Change-Id: I6eb0830b223977bbf0fc73f0cdf4f3b4cab962b5
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
When process finished while the message box querying for
a process to be stopped after a timeout was visible,
don't try to stop it and don't report a hang.
Change-Id: I74a819244a96d9e0209cabc6d58c0a1c4fe1ac31
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Get rid of two internal fields: m_hangTimerCount and m_waitingForUser.
Rename m_maxHangTimerCount into more meaningful m_timeoutInSeconds.
Fire single shot timers instead of a timer with interval.
Change-Id: I10890101273719f55a591eaecf818067aa5c503c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Move it locally to the only one user: VcsCommand.
For the future similar usages: use ProcessTask
and tweak the DoneResult inside TaskDoneHandler.
Change-Id: Icdffee7f1963f3ff377bfa6309e14bd1862a2c1f
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Make room for processutils.h which is going to contain
the exported stuff.
Change-Id: I87498c3a1d0708210aa970e2d45adaa0adb6e76a
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Since switching to a QProcess based implementation a different
code path is used to interrupt processes (QProcessImpl::sendControlSignal, instead of ProcessLauncherImpl::sendControlSignal).
The QProcess path still used outdated ProcessHelper::interruptProcess.
This patch removes the old path and replaces it with the correct
"ProcessHelper::interruptPid" for QProcess based processes.
This also fixes GdbEngine::interruptInferior2 which could not interrupt
processes during "Attach to running server"
Change-Id: I9e1917100acf89c07cab0d9c687e57bb555d9d83
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Queue the call to start() so that it's executed after the nested
event loop is started, otherwise it fails on Windows with QProcessImpl.
Fixes: QTCREATORBUG-30066
Change-Id: Ibb17ef0f668f52c05b26a521e18c94e637992ba5
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Checking the existence of qGuiApp isn't enough, since the
implementation just static_casts qApp to QGuiApplication.
The issue might happen in autotests if some function calls
methods of QGuiApplication. The autotests instantiate just
QCoreApplication by default.
Change-Id: Id384fb21b2a2ad66fac59bf5de35668ce50df1d1
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Change the argument of TaskInterface::done() signal
from bool into DoneResult. Make it consistent with
other TaskTree API.
Introduce toDoneResult(bool success) helper.
Change-Id: I7b3041d7c1ed0317c76adbc1fd37448231e85f82
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
It allows to set command/workingDir/env in one go.
Fix condition for setCommand() to match the one for setWorkingDir().
Change-Id: I0aa4639f3357c387a0fe8da321e94e34a3ea232d
Reviewed-by: hjk <hjk@qt.io>
Some places compared the scheme and host of a filepath to
decide whether its the same device. This is incorrect and
leads to false negatives. isSameDevice is the correct way
to decide whether two paths are from the same device.
Fixes: QTCREATORBUG-29474
Change-Id: Iced8f434dadb931f6595f47f95647b341c48d3aa
Reviewed-by: hjk <hjk@qt.io>
Pasting large amounts of data on macos would block the App indefinitely.
The issue was a blocking call to ::write. The first fix for that was to
set O_NONBLOCK on the tty stdout fd. The second fix was to pass the
actual result of the write back to the caller so they can react to it.
In the TerminalSurface we now check if the write was successful and
if not we buffer the data and try again later.
Change-Id: Ibc92cce57fad88b5e9aa325197b42e17bec5e746
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Terminal processes need to add to the stub and not the target app,
so sudo is only automatically added for default processes.
The terminal interface is changed such that sudo is added to the stub.
Task-number: QTCREATORBUG-27519
Change-Id: Ife11e937644c4e946401a5b079e90fa64aee2c52
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>