1/* GIO - GLib Input, Output and Streaming Library
2 *
3 * Copyright (C) 2012 Colin Walters <walters@verbum.org>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 *
18 * Author: Colin Walters <walters@verbum.org>
19 */
20
21#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
22#error "Only <gio/gio.h> can be included directly."
23#endif
24
25#ifndef __G_SUBPROCESS_H__
26#define __G_SUBPROCESS_H__
27
28#include <gio/giotypes.h>
29
30G_BEGIN_DECLS
31
32#define G_TYPE_SUBPROCESS (g_subprocess_get_type ())
33#define G_SUBPROCESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SUBPROCESS, GSubprocess))
34#define G_IS_SUBPROCESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SUBPROCESS))
35
36GLIB_AVAILABLE_IN_2_40
37GType g_subprocess_get_type (void) G_GNUC_CONST;
38
39/**** Core API ****/
40
41GLIB_AVAILABLE_IN_2_40
42GSubprocess * g_subprocess_new (GSubprocessFlags flags,
43 GError **error,
44 const gchar *argv0,
45 ...) G_GNUC_NULL_TERMINATED;
46GLIB_AVAILABLE_IN_2_40
47GSubprocess * g_subprocess_newv (const gchar * const *argv,
48 GSubprocessFlags flags,
49 GError **error);
50
51GLIB_AVAILABLE_IN_2_40
52GOutputStream * g_subprocess_get_stdin_pipe (GSubprocess *subprocess);
53
54GLIB_AVAILABLE_IN_2_40
55GInputStream * g_subprocess_get_stdout_pipe (GSubprocess *subprocess);
56
57GLIB_AVAILABLE_IN_2_40
58GInputStream * g_subprocess_get_stderr_pipe (GSubprocess *subprocess);
59
60GLIB_AVAILABLE_IN_2_40
61const gchar * g_subprocess_get_identifier (GSubprocess *subprocess);
62
63#ifdef G_OS_UNIX
64GLIB_AVAILABLE_IN_2_40
65void g_subprocess_send_signal (GSubprocess *subprocess,
66 gint signal_num);
67#endif
68
69GLIB_AVAILABLE_IN_2_40
70void g_subprocess_force_exit (GSubprocess *subprocess);
71
72GLIB_AVAILABLE_IN_2_40
73gboolean g_subprocess_wait (GSubprocess *subprocess,
74 GCancellable *cancellable,
75 GError **error);
76
77GLIB_AVAILABLE_IN_2_40
78void g_subprocess_wait_async (GSubprocess *subprocess,
79 GCancellable *cancellable,
80 GAsyncReadyCallback callback,
81 gpointer user_data);
82
83GLIB_AVAILABLE_IN_2_40
84gboolean g_subprocess_wait_finish (GSubprocess *subprocess,
85 GAsyncResult *result,
86 GError **error);
87
88GLIB_AVAILABLE_IN_2_40
89gboolean g_subprocess_wait_check (GSubprocess *subprocess,
90 GCancellable *cancellable,
91 GError **error);
92
93GLIB_AVAILABLE_IN_2_40
94void g_subprocess_wait_check_async (GSubprocess *subprocess,
95 GCancellable *cancellable,
96 GAsyncReadyCallback callback,
97 gpointer user_data);
98
99GLIB_AVAILABLE_IN_2_40
100gboolean g_subprocess_wait_check_finish (GSubprocess *subprocess,
101 GAsyncResult *result,
102 GError **error);
103
104
105GLIB_AVAILABLE_IN_2_40
106gint g_subprocess_get_status (GSubprocess *subprocess);
107
108GLIB_AVAILABLE_IN_2_40
109gboolean g_subprocess_get_successful (GSubprocess *subprocess);
110
111GLIB_AVAILABLE_IN_2_40
112gboolean g_subprocess_get_if_exited (GSubprocess *subprocess);
113
114GLIB_AVAILABLE_IN_2_40
115gint g_subprocess_get_exit_status (GSubprocess *subprocess);
116
117GLIB_AVAILABLE_IN_2_40
118gboolean g_subprocess_get_if_signaled (GSubprocess *subprocess);
119
120GLIB_AVAILABLE_IN_2_40
121gint g_subprocess_get_term_sig (GSubprocess *subprocess);
122
123GLIB_AVAILABLE_IN_2_40
124gboolean g_subprocess_communicate (GSubprocess *subprocess,
125 GBytes *stdin_buf,
126 GCancellable *cancellable,
127 GBytes **stdout_buf,
128 GBytes **stderr_buf,
129 GError **error);
130GLIB_AVAILABLE_IN_2_40
131void g_subprocess_communicate_async (GSubprocess *subprocess,
132 GBytes *stdin_buf,
133 GCancellable *cancellable,
134 GAsyncReadyCallback callback,
135 gpointer user_data);
136
137GLIB_AVAILABLE_IN_2_40
138gboolean g_subprocess_communicate_finish (GSubprocess *subprocess,
139 GAsyncResult *result,
140 GBytes **stdout_buf,
141 GBytes **stderr_buf,
142 GError **error);
143
144GLIB_AVAILABLE_IN_2_40
145gboolean g_subprocess_communicate_utf8 (GSubprocess *subprocess,
146 const char *stdin_buf,
147 GCancellable *cancellable,
148 char **stdout_buf,
149 char **stderr_buf,
150 GError **error);
151GLIB_AVAILABLE_IN_2_40
152void g_subprocess_communicate_utf8_async (GSubprocess *subprocess,
153 const char *stdin_buf,
154 GCancellable *cancellable,
155 GAsyncReadyCallback callback,
156 gpointer user_data);
157
158GLIB_AVAILABLE_IN_2_40
159gboolean g_subprocess_communicate_utf8_finish (GSubprocess *subprocess,
160 GAsyncResult *result,
161 char **stdout_buf,
162 char **stderr_buf,
163 GError **error);
164
165G_END_DECLS
166
167#endif /* __G_SUBPROCESS_H__ */
168