1/* GIO - GLib Input, Output and Streaming Library
2 *
3 * Copyright © 2012,2013 Colin Walters <walters@verbum.org>
4 * Copyright © 2012,2013 Canonical Limited
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General
17 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 *
19 * Author: Ryan Lortie <desrt@desrt.ca>
20 * Author: Colin Walters <walters@verbum.org>
21 */
22
23#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
24#error "Only <gio/gio.h> can be included directly."
25#endif
26
27#ifndef __G_SUBPROCESS_LAUNCHER_H__
28#define __G_SUBPROCESS_LAUNCHER_H__
29
30#include <gio/giotypes.h>
31
32G_BEGIN_DECLS
33
34#define G_TYPE_SUBPROCESS_LAUNCHER (g_subprocess_launcher_get_type ())
35#define G_SUBPROCESS_LAUNCHER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SUBPROCESS_LAUNCHER, GSubprocessLauncher))
36#define G_IS_SUBPROCESS_LAUNCHER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SUBPROCESS_LAUNCHER))
37
38GLIB_AVAILABLE_IN_2_40
39GType g_subprocess_launcher_get_type (void) G_GNUC_CONST;
40
41GLIB_AVAILABLE_IN_2_40
42GSubprocessLauncher * g_subprocess_launcher_new (GSubprocessFlags flags);
43
44GLIB_AVAILABLE_IN_2_40
45GSubprocess * g_subprocess_launcher_spawn (GSubprocessLauncher *self,
46 GError **error,
47 const gchar *argv0,
48 ...) G_GNUC_NULL_TERMINATED;
49
50GLIB_AVAILABLE_IN_2_40
51GSubprocess * g_subprocess_launcher_spawnv (GSubprocessLauncher *self,
52 const gchar * const *argv,
53 GError **error);
54
55GLIB_AVAILABLE_IN_2_40
56void g_subprocess_launcher_set_environ (GSubprocessLauncher *self,
57 gchar **env);
58
59GLIB_AVAILABLE_IN_2_40
60void g_subprocess_launcher_setenv (GSubprocessLauncher *self,
61 const gchar *variable,
62 const gchar *value,
63 gboolean overwrite);
64
65GLIB_AVAILABLE_IN_2_40
66void g_subprocess_launcher_unsetenv (GSubprocessLauncher *self,
67 const gchar *variable);
68
69GLIB_AVAILABLE_IN_2_40
70const gchar * g_subprocess_launcher_getenv (GSubprocessLauncher *self,
71 const gchar *variable);
72
73GLIB_AVAILABLE_IN_2_40
74void g_subprocess_launcher_set_cwd (GSubprocessLauncher *self,
75 const gchar *cwd);
76GLIB_AVAILABLE_IN_2_40
77void g_subprocess_launcher_set_flags (GSubprocessLauncher *self,
78 GSubprocessFlags flags);
79
80/* Extended I/O control, only available on UNIX */
81#ifdef G_OS_UNIX
82GLIB_AVAILABLE_IN_2_40
83void g_subprocess_launcher_set_stdin_file_path (GSubprocessLauncher *self,
84 const gchar *path);
85GLIB_AVAILABLE_IN_2_40
86void g_subprocess_launcher_take_stdin_fd (GSubprocessLauncher *self,
87 gint fd);
88GLIB_AVAILABLE_IN_2_40
89void g_subprocess_launcher_set_stdout_file_path (GSubprocessLauncher *self,
90 const gchar *path);
91GLIB_AVAILABLE_IN_2_40
92void g_subprocess_launcher_take_stdout_fd (GSubprocessLauncher *self,
93 gint fd);
94GLIB_AVAILABLE_IN_2_40
95void g_subprocess_launcher_set_stderr_file_path (GSubprocessLauncher *self,
96 const gchar *path);
97GLIB_AVAILABLE_IN_2_40
98void g_subprocess_launcher_take_stderr_fd (GSubprocessLauncher *self,
99 gint fd);
100
101GLIB_AVAILABLE_IN_2_40
102void g_subprocess_launcher_take_fd (GSubprocessLauncher *self,
103 gint source_fd,
104 gint target_fd);
105
106/* Child setup, only available on UNIX */
107GLIB_AVAILABLE_IN_2_40
108void g_subprocess_launcher_set_child_setup (GSubprocessLauncher *self,
109 GSpawnChildSetupFunc child_setup,
110 gpointer user_data,
111 GDestroyNotify destroy_notify);
112#endif
113
114G_END_DECLS
115
116#endif /* __G_SUBPROCESS_H__ */
117