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
This commit is contained in:
Colin Walters
2012-05-17 14:37:17 -04:00
committed by Ryan Lortie
parent e30bbca667
commit 5b48dc40cc
17 changed files with 3963 additions and 60 deletions

View File

@@ -108,6 +108,10 @@
<xi:include href="xml/ginitable.xml"/>
<xi:include href="xml/gasyncinitable.xml"/>
</chapter>
<chapter id="subprocesses">
<title>Subprocesses</title>
<xi:include href="xml/gsubprocess.xml"/>
</chapter>
<chapter id="networking">
<title>Low-level network support</title>
<xi:include href="xml/gsocket.xml"/>

View File

@@ -4077,4 +4077,37 @@ G_SIMPLE_PROXY_RESOLVER_CLASS
G_IS_SIMPLE_PROXY_RESOLVER_CLASS
G_SIMPLE_PROXY_RESOLVER_GET_CLASS
g_simple_proxy_resolver_get_type
<FILE>gsubprocess</FILE>
<TITLE>GSubprocess</TITLE>
GSubprocess
g_subprocess_new
g_subprocess_newv
<SUBSECTION IO>
g_subprocess_get_stdin_pipe
g_subprocess_get_stdout_pipe
g_subprocess_get_stderr_pipe
<SUBSECTION Waiting>
g_subprocess_wait
g_subprocess_wait_sync
g_subprocess_wait_finish
g_subprocess_wait_check
g_subprocess_wait_check_sync
g_subprocess_wait_check_finish
<SUBSECTION Status>
g_subprocess_get_successful
g_subprocess_get_if_exited
g_subprocess_get_exit_status
g_subprocess_get_if_signaled
g_subprocess_get_term_sig
g_subprocess_get_status
<SUBSECTION Control>
g_subprocess_send_signal
g_subprocess_force_exit
<SUBSECTION Standard>
G_IS_SUBPROCESS
G_TYPE_SUBPROCESS
G_SUBPROCESS
<SUBSECTION Private>
g_subprocess_get_type
</SECTION>

View File

@@ -137,3 +137,4 @@ g_test_dbus_get_type
g_test_dbus_flags_get_type
g_task_get_type
g_simple_proxy_resolver_get_type
g_subprocess_get_type