WIN32: Spawning a command-line process

2009-01-27 Thread Tomas Soltys
Hi, I am writing a GUI application which executes a command-line executable and reads its output from stdout. For this I am using function g_spawn_async_with_pipes. If command-line program is linked with -mswindows then everything works fine, but I can not execute prog in command line. Stdout is

Re: WIN32: Spawning a command-line process

2009-01-27 Thread Tor Lillqvist
Resending with a slight rewording to get this message intact into the gtk-app-devel-list archive. The archive software at mail.gnome.org has the From bug!... If command-line program is linked with -mswindows You mean -mwindows (just a typo, I am sure, but in case somebody else doesn't know).

Re: WIN32: Spawning a command-line process

2009-01-27 Thread Tor Lillqvist
Compile this sample program Compile it with -mwindows , I forgot to say. It doesn't do anything interesting if built as a console .exe, in fact gives a misleading error message... --tml ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org

Re: WIN32: Spawning a command-line process

2009-01-27 Thread jcupitt
2009/1/27 Tor Lillqvist t...@iki.fi: If you don't want to do that, your simplest option is to just build two separate versions of the prog program: One linked with -mwindows, one without. Note that you don't have to change a single line of code to make it into a GUI application, just link it

Re: WIN32: Spawning a command-line process

2009-01-27 Thread Tor Lillqvist
Let me add also that before you do any of that AttachConsole() and freopen() magic, you should of course make sure that stdout actually is attached to an invalid file handle. (stdout normally is attached to an invalid file handle in a GUI.exe that has been started without redirecting its stdout.