diff options
author | Simon McVittie <smcv@collabora.com> | 2021-02-25 12:22:23 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2021-02-25 12:22:34 +0000 |
commit | 2db42705a7e413953d26930880951734ab0df931 (patch) | |
tree | 4ef7a5f1f7973a142ab4edafe8d2969ddbc5d778 /gio/gsubprocess.c | |
parent | 6259fb5be7f727fba1507315f79791ee0f2dee66 (diff) | |
download | glib-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 'gio/gsubprocess.c')
-rw-r--r-- | gio/gsubprocess.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gio/gsubprocess.c b/gio/gsubprocess.c index 77a23efc3..c0f4f8db6 100644 --- a/gio/gsubprocess.c +++ b/gio/gsubprocess.c @@ -883,7 +883,7 @@ g_subprocess_wait (GSubprocess *subprocess, * @cancellable: a #GCancellable * @error: a #GError * - * Combines g_subprocess_wait() with g_spawn_check_exit_status(). + * Combines g_subprocess_wait() with g_spawn_check_wait_status(). * * Returns: %TRUE on success, %FALSE if process exited abnormally, or * @cancellable was cancelled @@ -896,7 +896,7 @@ g_subprocess_wait_check (GSubprocess *subprocess, GError **error) { return g_subprocess_wait (subprocess, cancellable, error) && - g_spawn_check_exit_status (subprocess->status, error); + g_spawn_check_wait_status (subprocess->status, error); } /** @@ -906,7 +906,7 @@ g_subprocess_wait_check (GSubprocess *subprocess, * @callback: a #GAsyncReadyCallback to call when the operation is complete * @user_data: user_data for @callback * - * Combines g_subprocess_wait_async() with g_spawn_check_exit_status(). + * Combines g_subprocess_wait_async() with g_spawn_check_wait_status(). * * This is the asynchronous version of g_subprocess_wait_check(). * @@ -940,7 +940,7 @@ g_subprocess_wait_check_finish (GSubprocess *subprocess, GError **error) { return g_subprocess_wait_finish (subprocess, result, error) && - g_spawn_check_exit_status (subprocess->status, error); + g_spawn_check_wait_status (subprocess->status, error); } #ifdef G_OS_UNIX @@ -1053,7 +1053,7 @@ g_subprocess_force_exit (GSubprocess *subprocess) * * This value has no particular meaning, but it can be used with the * macros defined by the system headers such as WIFEXITED. It can also - * be used with g_spawn_check_exit_status(). + * be used with g_spawn_check_wait_status(). * * It is more likely that you want to use g_subprocess_get_if_exited() * followed by g_subprocess_get_exit_status(). |