gsubprocess.h 8.4 KB

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