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

René J. V. Bertin rjvbertin at gmail.com
Thu Jan 7 22:14:47 CET 2016


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.

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, 
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.




More information about the Development mailing list