[Interest] Enforce only stdin/out/err inherited with QProcess

Thiago Macieira thiago.macieira at intel.com
Wed Sep 25 19:48:05 CEST 2024


On Wednesday 25 September 2024 08:36:47 GMT-7 christoph at cullmann.io wrote:
> > Since you want no handles but the standard three, would setting
> > 
> >   args->inheritHandles = false
> > 
> > suffice?
> 
> I tried that but for me that fails, I have no handles and unlike on
> Linux
> or Mac with the other code path I can no longer read any output from the
> QProcess.
> 
> I did read a bit the Windows docs and the Qt code and its seems
> inheritHandles = TRUE
> is required if you use the STARTF_USESTDHANDLES flag in the startup info
> like Qt does.

Ah, ok.

So it looks like doing what you tried to do by understanding Raymond Chen's 
blog is the way to go... except it didn't work. Aside from the fact that you 
didn't clean the thread's handle state or at least didn't include it in the 
code you pasted, I see no reason it shouldn't work.

Maybe there's some non-obvious mistake. Implementing it directly in 
qprocess_win.cpp may make it work.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Principal Engineer - Intel DCAI Platform & System Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5152 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20240925/9fecc61e/attachment.bin>


More information about the Interest mailing list