[Development] RFC: QProcess variant or separate class for launching applications "GUI-style"

Ziller Eike Eike.Ziller at theqtcompany.com
Fri Jan 8 10:03:36 CET 2016

> On Jan 7, 2016, at 10:14 PM, René J. V. Bertin <rjvbertin at gmail.com> wrote:
> Sorvig Morten wrote:
>> Another point: Isn't there a fundamental incompatibiity between LaunchServices
>> and QProcess? LanchServices may ‘activate’ an already running process, while
>> QProcess always starts a new process.

That should be possible to be prohibited with launch flag kLSLaunchNewInstance

> This is something that I think we have not yet taken into consideration. It 
> doesn't necessarily matter for a "startDetached" form of launching though,

If you just care about starting an application and being notified when it finishes, without the need for output/input streams or PIDs, then you can probably just run “/usr/bin/open -n -W <yourappbundle>"

Br, Eike

>  where/when you don't care if the detached process is a newly started one or an 
> already running process. It should be possible to detect termination for such a 
> "reused" process too (via an NSNotificationCentre), so I think one could write a 
> class that behaves as the same regardless of whether the process it interfaces 
> with is a newly started process or not.
> Maybe rather a QGuiProcess then? Or is OS X really the only OS where there 
> exists a specific spawning API for GUI apps in addition to a more traditional 
> Posix one?
> NB: a contact at Apple taught me 2 things in this context:
> - app bundle executables may not always start through system() or exec() in the 
> future (which will probably force a redesign of QProcess)
> - even in cases where fork+exec is appropriate, one should rather use 
> posix_spawn(). (This would concern shell scripts, non gui apps or "agents" that 
> should remain in the background until they decide otherwise themselves, etc.)
> R.
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development

Eike Ziller, Principle Software Engineer - The Qt Company GmbH
The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B

More information about the Development mailing list