Process: Refactor timeout handling

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>
This commit is contained in:
Jarek Kobus
2024-01-22 12:49:58 +01:00
parent 886ac041e5
commit f6be85b1d2
9 changed files with 51 additions and 70 deletions

View File

@@ -119,7 +119,7 @@ void FetchContext::processDone()
deleteLater();
if (m_process.result() != ProcessResult::FinishedWithSuccess) {
if (!m_process.resultData().m_canceledByUser)
if (m_process.result() != ProcessResult::Canceled)
VcsBase::VcsOutputWindow::appendError(m_process.exitMessage());
return;
}