| 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 |  | 
|---|
| 30 | G_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 |  | 
|---|
| 36 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 37 | GType            g_subprocess_get_type                  (void) G_GNUC_CONST; | 
|---|
| 38 |  | 
|---|
| 39 | /**** Core API ****/ | 
|---|
| 40 |  | 
|---|
| 41 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 42 | GSubprocess *    g_subprocess_new                       (GSubprocessFlags        flags, | 
|---|
| 43 | GError                **error, | 
|---|
| 44 | const gchar            *argv0, | 
|---|
| 45 | ...) G_GNUC_NULL_TERMINATED; | 
|---|
| 46 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 47 | GSubprocess *    g_subprocess_newv                      (const gchar * const  *argv, | 
|---|
| 48 | GSubprocessFlags      flags, | 
|---|
| 49 | GError              **error); | 
|---|
| 50 |  | 
|---|
| 51 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 52 | GOutputStream *  g_subprocess_get_stdin_pipe            (GSubprocess          *subprocess); | 
|---|
| 53 |  | 
|---|
| 54 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 55 | GInputStream *   g_subprocess_get_stdout_pipe           (GSubprocess          *subprocess); | 
|---|
| 56 |  | 
|---|
| 57 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 58 | GInputStream *   g_subprocess_get_stderr_pipe           (GSubprocess          *subprocess); | 
|---|
| 59 |  | 
|---|
| 60 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 61 | const gchar *    g_subprocess_get_identifier            (GSubprocess          *subprocess); | 
|---|
| 62 |  | 
|---|
| 63 | #ifdef G_OS_UNIX | 
|---|
| 64 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 65 | void             g_subprocess_send_signal               (GSubprocess          *subprocess, | 
|---|
| 66 | gint                  signal_num); | 
|---|
| 67 | #endif | 
|---|
| 68 |  | 
|---|
| 69 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 70 | void             g_subprocess_force_exit                (GSubprocess          *subprocess); | 
|---|
| 71 |  | 
|---|
| 72 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 73 | gboolean         g_subprocess_wait                      (GSubprocess          *subprocess, | 
|---|
| 74 | GCancellable         *cancellable, | 
|---|
| 75 | GError              **error); | 
|---|
| 76 |  | 
|---|
| 77 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 78 | void             g_subprocess_wait_async                (GSubprocess          *subprocess, | 
|---|
| 79 | GCancellable         *cancellable, | 
|---|
| 80 | GAsyncReadyCallback   callback, | 
|---|
| 81 | gpointer              user_data); | 
|---|
| 82 |  | 
|---|
| 83 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 84 | gboolean         g_subprocess_wait_finish               (GSubprocess          *subprocess, | 
|---|
| 85 | GAsyncResult         *result, | 
|---|
| 86 | GError              **error); | 
|---|
| 87 |  | 
|---|
| 88 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 89 | gboolean         g_subprocess_wait_check                (GSubprocess          *subprocess, | 
|---|
| 90 | GCancellable         *cancellable, | 
|---|
| 91 | GError              **error); | 
|---|
| 92 |  | 
|---|
| 93 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 94 | void             g_subprocess_wait_check_async          (GSubprocess          *subprocess, | 
|---|
| 95 | GCancellable         *cancellable, | 
|---|
| 96 | GAsyncReadyCallback   callback, | 
|---|
| 97 | gpointer              user_data); | 
|---|
| 98 |  | 
|---|
| 99 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 100 | gboolean         g_subprocess_wait_check_finish         (GSubprocess          *subprocess, | 
|---|
| 101 | GAsyncResult         *result, | 
|---|
| 102 | GError              **error); | 
|---|
| 103 |  | 
|---|
| 104 |  | 
|---|
| 105 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 106 | gint             g_subprocess_get_status                (GSubprocess          *subprocess); | 
|---|
| 107 |  | 
|---|
| 108 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 109 | gboolean         g_subprocess_get_successful            (GSubprocess          *subprocess); | 
|---|
| 110 |  | 
|---|
| 111 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 112 | gboolean         g_subprocess_get_if_exited             (GSubprocess          *subprocess); | 
|---|
| 113 |  | 
|---|
| 114 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 115 | gint             g_subprocess_get_exit_status           (GSubprocess          *subprocess); | 
|---|
| 116 |  | 
|---|
| 117 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 118 | gboolean         g_subprocess_get_if_signaled           (GSubprocess          *subprocess); | 
|---|
| 119 |  | 
|---|
| 120 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 121 | gint             g_subprocess_get_term_sig              (GSubprocess          *subprocess); | 
|---|
| 122 |  | 
|---|
| 123 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 124 | gboolean         g_subprocess_communicate               (GSubprocess          *subprocess, | 
|---|
| 125 | GBytes               *stdin_buf, | 
|---|
| 126 | GCancellable         *cancellable, | 
|---|
| 127 | GBytes              **stdout_buf, | 
|---|
| 128 | GBytes              **stderr_buf, | 
|---|
| 129 | GError              **error); | 
|---|
| 130 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 131 | void            g_subprocess_communicate_async          (GSubprocess          *subprocess, | 
|---|
| 132 | GBytes               *stdin_buf, | 
|---|
| 133 | GCancellable         *cancellable, | 
|---|
| 134 | GAsyncReadyCallback   callback, | 
|---|
| 135 | gpointer              user_data); | 
|---|
| 136 |  | 
|---|
| 137 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 138 | gboolean        g_subprocess_communicate_finish         (GSubprocess          *subprocess, | 
|---|
| 139 | GAsyncResult         *result, | 
|---|
| 140 | GBytes              **stdout_buf, | 
|---|
| 141 | GBytes              **stderr_buf, | 
|---|
| 142 | GError              **error); | 
|---|
| 143 |  | 
|---|
| 144 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 145 | gboolean         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); | 
|---|
| 151 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 152 | void            g_subprocess_communicate_utf8_async     (GSubprocess          *subprocess, | 
|---|
| 153 | const char           *stdin_buf, | 
|---|
| 154 | GCancellable         *cancellable, | 
|---|
| 155 | GAsyncReadyCallback   callback, | 
|---|
| 156 | gpointer              user_data); | 
|---|
| 157 |  | 
|---|
| 158 | GLIB_AVAILABLE_IN_2_40 | 
|---|
| 159 | gboolean        g_subprocess_communicate_utf8_finish    (GSubprocess          *subprocess, | 
|---|
| 160 | GAsyncResult         *result, | 
|---|
| 161 | char                **stdout_buf, | 
|---|
| 162 | char                **stderr_buf, | 
|---|
| 163 | GError              **error); | 
|---|
| 164 |  | 
|---|
| 165 | G_END_DECLS | 
|---|
| 166 |  | 
|---|
| 167 | #endif /* __G_SUBPROCESS_H__ */ | 
|---|
| 168 |  | 
|---|