Add a spawn module for Geany
commitce0fa6ffa17befa0969653a0312b38a5429f1d6e
authorDimitar Zhekov <dimitar.zhekov@gmail.com>
Tue, 10 Mar 2015 19:24:42 +0000 (10 21:24 +0200)
committerDimitar Zhekov <dimitar.zhekov@gmail.com>
Tue, 10 Mar 2015 19:24:42 +0000 (10 21:24 +0200)
tree0477ffab8db1d28e4efe873002fd16e1355f8e5f
parent7254bf96644058afa84b0aabd603f87d611615d0
Add a spawn module for Geany

g_spawn_async_with_pipes() under Windows has various drawbacks:

- There is no g_shell_parse_argv() for windows. It's not hard to write
  one, but the command line recreated by mscvrt may be wrong.
- GLib converts the argument vector to UNICODE. For non-UTF8 arguments,
  the result is often "Invalid string in argument vector at %d: %s:
  Invalid byte sequence in conversion input" (YMMV). Our tools (make,
  grep, gcc, ...) are "ANSI", so converting to UNICODE and then back
  only causes problems.
- For various reasons, GLib uses an intermediate program to start
  children (see gspawn-win32.c), with the side effect that the
  grandchildren output (such as make -> gcc) is not captured.
- With non-blocking pipes, the g_io_add_watch() callbacks are never
  invoked, while with blocking pipes, g_io_channel_read_line() blocks.
- Some smaller problems, explained in spawn.c as inline comments.

The spawn module tries to fix these problems, and to provide easier
APIs, which guarantee that the callbacks will synchronized as expected,
and g_io_channel_read_line() will not be required, since even under
Unix, it may buffer lines of unlimited length.

This initial commit only adds the module source and header files, and
includes it in the various build systems.

You can see PR 274 for a long discussion about the module.
src/Makefile.am
src/makefile.win32
src/spawn.c [new file with mode: 0644]
src/spawn.h [new file with mode: 0644]
wscript