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/tests/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/tests/gsubprocess.c')
-rw-r--r-- | gio/tests/gsubprocess.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gio/tests/gsubprocess.c b/gio/tests/gsubprocess.c index 7e22678ec..78acfdc75 100644 --- a/gio/tests/gsubprocess.c +++ b/gio/tests/gsubprocess.c @@ -611,7 +611,7 @@ on_subprocess_exited (GObject *object, g_propagate_error (&data->error, error); } } - g_spawn_check_exit_status (g_subprocess_get_exit_status (subprocess), &error); + g_spawn_check_wait_status (g_subprocess_get_exit_status (subprocess), &error); g_assert_no_error (error); data->events_pending--; if (data->events_pending == 0) @@ -1281,7 +1281,7 @@ on_request_quit_exited (GObject *object, g_assert_true (g_subprocess_get_if_signaled (subprocess)); g_assert_cmpint (g_subprocess_get_term_sig (subprocess), ==, 9); #endif - g_spawn_check_exit_status (g_subprocess_get_status (subprocess), &error); + g_spawn_check_wait_status (g_subprocess_get_status (subprocess), &error); g_assert_nonnull (error); g_clear_error (&error); |