Web lists-archives.com

Re: Can't read stdout of bash with GSubprocess on MSYS2

On 28.09.2015 22:07, Earnie wrote:
> On 9/27/2015 10:01 PM, Gang Chen wrote:
>> Hi,
>> I'm writing a GTK+ application with MINGW-W64, which spawns a subprocess
>> running bash to execute some commands with GSubprocess and reads stdout
>> of bash (installed from MSYS2). I found that if compiled without
>> "-mwindows" compilation option the main process can read the stdout,
>> while with "-mwindows", the read function always returns 0 bytes read.
>> If the main process runs a normal console program, or like
>> "mingw32/bin/gcc.exe", then it can read stdout even if compiled with
>> "-mwindows".
> The -mwindows option tells the compiler to not include the code to use
> CONSOLE code such that stdin, stdout and stderr are not open.  Knowing
> this what you describe makes sense.

Not exactly. The fact that the parent process lacks a console (and thus has
no stdin, stdout or stderr) should not prevent it from spawning a child
process that has stdout and/or stderr set to pipes. If it does prevent that
(which is yet to be seen), i'd say it's a bug. Also note that behaviour
changes depending on what the child process (a console application in
either case) does.

O< ascii ribbon - stop html email! - www.asciiribbon.org

Attachment: 0x922360B0.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature

gtk-list mailing list