summaryrefslogtreecommitdiff
path: root/glib/gspawn.h
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2021-02-25 12:22:23 +0000
committerSimon McVittie <smcv@collabora.com>2021-02-25 12:22:34 +0000
commit2db42705a7e413953d26930880951734ab0df931 (patch)
tree4ef7a5f1f7973a142ab4edafe8d2969ddbc5d778 /glib/gspawn.h
parent6259fb5be7f727fba1507315f79791ee0f2dee66 (diff)
downloadglib-wip/wait-status.tar.gz
Distinguish more clearly between wait status and exit statuswip/wait-status
On Unix platforms, wait() and friends yield an integer that encodes how the process exited. Confusingly, this is usually not the same as the integer passed to exit() or returned from main(). I find that it's clearer what is going on if we are consistent about referring to the result of wait() as a "wait status", and the value passed to exit() as an "exit status". GSubprocess already gets this right: g_subprocess_get_status() returns the wait status, while g_subprocess_get_exit_status() genuinely returns the exit status. However, the GSpawn family of APIs has tended to conflate the two. Confusingly, g_spawn_check_exit_status() has always checked a wait status, and it would not be correct to pass an exit status to it. Deprecate it in favour of g_spawn_check_wait_status(), which does the same thing. Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'glib/gspawn.h')
-rw-r--r--glib/gspawn.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/glib/gspawn.h b/glib/gspawn.h
index e09dc2aec..2449d64c1 100644
--- a/glib/gspawn.h
+++ b/glib/gspawn.h
@@ -95,7 +95,7 @@ typedef enum
/**
* G_SPAWN_EXIT_ERROR:
*
- * Error domain used by g_spawn_check_exit_status(). The code
+ * Error domain used by g_spawn_check_wait_status(). The code
* will be the program exit code.
*/
#define G_SPAWN_EXIT_ERROR g_spawn_exit_error_quark ()
@@ -259,21 +259,25 @@ gboolean g_spawn_sync (const gchar *working_directory,
gpointer user_data,
gchar **standard_output,
gchar **standard_error,
- gint *exit_status,
+ gint *wait_status,
GError **error);
GLIB_AVAILABLE_IN_ALL
gboolean g_spawn_command_line_sync (const gchar *command_line,
gchar **standard_output,
gchar **standard_error,
- gint *exit_status,
+ gint *wait_status,
GError **error);
GLIB_AVAILABLE_IN_ALL
gboolean g_spawn_command_line_async (const gchar *command_line,
GError **error);
-GLIB_AVAILABLE_IN_2_34
-gboolean g_spawn_check_exit_status (gint exit_status,
+GLIB_AVAILABLE_IN_2_70
+gboolean g_spawn_check_wait_status (gint wait_status,
+ GError **error);
+
+GLIB_AVAILABLE_IN_2_34 /* Also deprecated, but can't mark something both AVAILABLE and DEPRECATED */
+gboolean g_spawn_check_exit_status (gint wait_status,
GError **error);
GLIB_AVAILABLE_IN_ALL