[Qt-creator] Utils::QtcProcess
Jaroslaw Kobus
Jaroslaw.Kobus at qt.io
Wed Jan 25 16:41:26 CET 2023
Hi,
QtcProcess is a wrapper around QProcess. It has some advantages over the QProcess:
1. On linux, when starting a new QProcess, the whole callee's application is being forked.
The bigger the application is, the longer the fork takes place. And QtCreator is a really huge.
So, QtcProcess comes with a solution: all the processes are being started not directly by QtCreator,
but with helper application called qtcreator_processlauncher. All start requests of all QtcProcesses
are redirected to that application. Since qtcreator_processlauncher is much smaller that QtCreator,
processes start faster. You may turn off this by behaviour by launching Creator with QTC_USE_QPROCESS=true
variable set - in this case the process launcher won't be used, but QProcess directly.
You may also hardcode the underlaying implementation for your particular instance of QtcProcess
by calling QtcProcess::setProcessImpl(ProcessImpl::QProcess).
2. When using QtcProcess it is also safe to destruct it while underlaying QProcess is still being run.
QtcProcess takes care about safe termination through Utils::ProcessReaper in the background.
3. There are much more advantages over bare QProcess, e.g. it enables running applications
on remote devices transparently. All you need to do is to specify the remote FilePath to your
executable inside QtcProcess::setCommandLine() and that's all.
I hope this helps
Regards
Jarek
________________________________________
From: Qt-creator <qt-creator-bounces at qt-project.org> on behalf of Knut Petter Svendsen via Qt-creator <qt-creator at qt-project.org>
Sent: Wednesday, January 25, 2023 4:22 PM
To: Qt-creator at qt-project.org
Subject: [Qt-creator] Utils::QtcProcess
What's the idea with Utils::QtcProcess? Why does QtCreator use QtcProcess
over simply using QProcess?
Also, when trying to debug a ClearCasePlugin which I haven't tested since
QtC 4.xx I'm having a hard time actually finding out where the command is
actually executed. I'm having problems with stepping in the code to find
out why the plugin is failing in my environment.
In my own plugin I use QProcess and it works - is there any reason I
should start using the more complicated QtcProcess (which I'm having
problems with in ClearCasePlugin...)
Knut
_______________________________________________
Qt-creator mailing list
Qt-creator at qt-project.org
https://lists.qt-project.org/listinfo/qt-creator
More information about the Qt-creator
mailing list