Commit Graph

12 Commits

Author SHA1 Message Date
Sébastien Wilmet
82352ab8e7 doc: various improvements
- g_subprocess_launcher_spawn() and spawnv(): there is no other way
  AFAIK to create a GSubprocess from a launcher. So these
  functions are not "convenience helper".

- annotate optional arguments for g_shell_parse_argv().

- other trivial fix

https://bugzilla.gnome.org/show_bug.cgi?id=732357
2014-06-29 17:57:24 +02:00
Philip Withnall
e1243d11f0 gsubprocess: Add a missing va_end() call
Coverity issues: #1214070, #1214069

https://bugzilla.gnome.org/show_bug.cgi?id=730278
2014-05-20 11:01:37 +01:00
Ryan Lortie
e767204e0e GSubprocessLauncher: don't get empty environment
Use g_get_environ() to get the environment variables with their values
instead of g_listenv() which only lists off the keys.

https://bugzilla.gnome.org/show_bug.cgi?id=725651
2014-03-04 08:55:00 -05:00
Matthias Clasen
3872049445 Add includes to all gio docs 2014-01-07 22:55:43 -05:00
Morten Welinder
c26c557908 gsubprocesslauncher: Use "env" instead of "environ"
The latter may come from system headers.

https://bugzilla.gnome.org/show_bug.cgi?id=721059
2013-12-26 07:37:17 -05:00
Colin Walters
2ad121ab16 gsubprocesslauncher: Annotate g_subprocess_launcher_spawnv()
Needs to be an array.
2013-12-15 20:44:53 -05:00
Matthias Clasen
7ef1eccd7e Fix g_subprocess_launcher_spawn
This function turns a varargs argument list into a string array,
but forgets to NULL-terminate it. This function was not covered
by unit tests...so it was broken.
2013-11-28 01:34:52 -05:00
Ryan Lortie
358588ed2a GSubprocess win32 fixups
Note: we go out of our way not to pass a child setup function on win32
(even if it does nothing) because we get a g_warning() from gspawn if we
do so.
2013-10-21 15:24:55 -04:00
Matthias Clasen
c848323948 Fix up subprocess docs
The GSubprocessLauncher docs had their own long description,
but were not properly set up as their own section.
2013-10-17 20:55:53 -04:00
Ryan Lortie
542ad4db03 Fixup GSubprocess documentation bits 2013-10-17 15:01:42 -04:00
Colin Walters
0e1a3ee345 gsubprocess: Fix up communicate
We weren't closing the streams after we were done reading or writing,
which is kind of essential.  The easy way to fix this is to just use
g_output_stream_splice() to a GMemoryOutputStream rather than
hand-rolling it.  This results in a substantial reduction of code
complexity.

A second serious issue is that we were marking the task as complete when
the process exits, but that's racy - there could still be data to read
from stdout.  Fix this by just refcounting outstanding operations.

This code, not surprisingly, looks a lot like the "multi" test.

Next, because processes output binary data, I'd be forced to annotate
the char*/length pairs as (array) (element-type uint8).  But rather than
doing that, it's *far* simpler to just use GBytes.

We need a version of this that actually validates as UTF-8, that will be
in the next patch.
2013-10-17 14:32:44 -04:00
Colin Walters
5b48dc40cc GSubprocess: New class for spawning child processes
There are a number of nice things this class brings:

0) Has a race-free termination API on all platforms (on UNIX, calls to
   kill() and waitpid() are coordinated as not to cause problems).
1) Operates in terms of G{Input,Output}Stream, not file descriptors
2) Standard GIO-style async API for wait() with cancellation
3) Makes some simple cases easy, like synchronously spawning a
   process with an argument list
4) Makes hard cases possible, like asynchronously running a process
   with stdout/stderr merged, output directly to a file path

Much rewriting and code review from Ryan Lortie <desrt@desrt.ca>

https://bugzilla.gnome.org/show_bug.cgi?id=672102
2013-10-17 14:32:44 -04:00