[Geany-Devel] [geany/geany] a3664f: Fix spawning [synchronous] commands on Windows

Dimitar Zhekov dimitar.zhekov at gmail.com
Fri Nov 16 20:31:13 UTC 2012


On Thu, 15 Nov 2012 13:06:53 +0000
Nick Treleaven <nick.treleaven at btinternet.com> wrote:

> >> On 26/10/2012 17:44, Dimitar Zhekov wrote:
> >>> I'm using Geany on win~1 recently, with gtk+2.16 and glib-2.22 (the
> >>> minimum versions). g_spawn_async_with_pipes() works fine for me, from a
> >>> plugin, for a console application, along with the helper.
> >>
> >> So redirecting I/O works for stdout, stderr and it works for build
> >> commands like gcc, make, grep, etc?
> >
> > It works between a console program and the plugin that spawned it, with
> > {PeekNamedPipe() + read()} and {repeat write() on N ms} calls.
> 
> This confused me. Are you saying you use native Windows functions in 
> combination with g_spawn? I thought only g_io_add_watch could be used.

g_spawn_async_with_pipes() returns libc/msvcrt fd-s. You can use them
to create channels, or directly.

Anonymous win~1 pipe fd-s are handled by giowin like regular fd-s
(G_IO_WIN32_FILE_DESC), which causes problems, and I wanted a single
g_source with the order of stdin/out/err operations order under my
control. So calling read() and write() turned out to be easier. giowin
uses them at the lowest level too.

-- 
E-gards: Jimmy


More information about the Devel mailing list