summaryrefslogtreecommitdiff
path: root/gio/gsubprocess.h
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2013-10-15 15:04:54 +0100
committerColin Walters <walters@verbum.org>2013-10-15 15:04:54 +0100
commitfe476f9589caff4fbf494b2f89da7201a531752f (patch)
tree5813f7445d2832f3d1ef0a9af86cb6e5a8852510 /gio/gsubprocess.h
parent41f0ebe14aa4d66532589dda518844bcb34638da (diff)
downloadglib-wip/le-gsubprocess.tar.gz
gsubprocess: Add UTF-8 variants of communicate()wip/le-gsubprocess
Over many years of writing code interacting with subprocesses, a pattern that comes up a lot is to run a child and get its output as UTF-8, to put inside a JSON document or render in a GtkTextBuffer, etc. It's very important to validate at the boundaries, and not say deep inside Pango. We could do this a bit more efficiently if done in a streaming fashion, but realistically this should be OK for now.
Diffstat (limited to 'gio/gsubprocess.h')
-rw-r--r--gio/gsubprocess.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/gio/gsubprocess.h b/gio/gsubprocess.h
index febdeb834..71017ed6b 100644
--- a/gio/gsubprocess.h
+++ b/gio/gsubprocess.h
@@ -143,6 +143,27 @@ gboolean g_subprocess_communicate_finish (GSubprocess *s
GBytes **stderr_buf,
GError **error);
+GLIB_AVAILABLE_IN_2_40
+gboolean g_subprocess_communicate_utf8 (GSubprocess *subprocess,
+ const char *stdin_buf,
+ GCancellable *cancellable,
+ char **stdout_buf,
+ char **stderr_buf,
+ GError **error);
+GLIB_AVAILABLE_IN_2_40
+void g_subprocess_communicate_utf8_async (GSubprocess *subprocess,
+ const char *stdin_buf,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GLIB_AVAILABLE_IN_2_40
+gboolean g_subprocess_communicate_utf8_finish (GSubprocess *subprocess,
+ GAsyncResult *result,
+ char **stdout_buf,
+ char **stderr_buf,
+ GError **error);
+
G_END_DECLS
#endif /* __G_SUBPROCESS_H__ */