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

christoph at cullmann.io christoph at cullmann.io
Wed Sep 25 20:15:41 CEST 2024


On 2024-09-25 19:48, Thiago Macieira wrote:
> 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.

Yeah, that cleanup code would be after the start().

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

Ok, thanks for taking a look, I will see if I find the error or perhaps 
somebody
else has input, too.

At the moment I am just a bit confused what it might be, I did some 
errors
before I arrived with that, but then at least I got some API errors 
back,
now just the output from my called process won't arrive.

Greetings
Christoph


More information about the Interest mailing list