Unfortunately, due to the internal architecture of QProcess
, there's no support for this. You'd need to copy-paste a bunch of QProcess
code to a new class and add the missing functionality yourself.
There's an easier way, though: create a process wrapper that exposes a QProcess
via QLocalSocket
. The wrapper is simple and shouldn't be crashing. It can self-terminate when the process itself terminates, to prevent dangling wrappers from hanging around. When your application crashes or is terminated, the new instance can try to attach to the local socket if a wrapper exists. If it doesn't exist, then it will spawn a new wrapper.