[Qt-creator] Utils::QtcProcess
Milian Wolff
mail at milianw.de
Mon Feb 13 13:48:39 CET 2023
On Mittwoch, 25. Januar 2023 16:41:26 CET Jaroslaw Kobus via Qt-creator wrote:
> 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).
FTR: This got fixed upstream last year:
https://codereview.qt-project.org/c/qt/qtbase/+/417829
> 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.
What does this do other than terminating the process? How is this more safe?
Can/should this be upstreamed to QtCore if it's such a general important
improvement?
> 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
--
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20230213/41adbc61/attachment.sig>
More information about the Qt-creator
mailing list