summaryrefslogtreecommitdiff
path: root/glib/tests/spawn-singlethread.c
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/tests/spawn-singlethread.c
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/tests/spawn-singlethread.c')
-rw-r--r--glib/tests/spawn-singlethread.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/glib/tests/spawn-singlethread.c b/glib/tests/spawn-singlethread.c
index 51a1da514..bb66f3bdd 100644
--- a/glib/tests/spawn-singlethread.c
+++ b/glib/tests/spawn-singlethread.c
@@ -408,17 +408,17 @@ test_spawn_nonexistent (void)
GError *error = NULL;
GPtrArray *argv = NULL;
gchar *stdout_str = NULL;
- gint exit_status = -1;
+ gint wait_status = -1;
argv = g_ptr_array_new ();
g_ptr_array_add (argv, "this does not exist");
g_ptr_array_add (argv, NULL);
g_spawn_sync (NULL, (char**) argv->pdata, NULL, 0, NULL, NULL, &stdout_str,
- NULL, &exit_status, &error);
+ NULL, &wait_status, &error);
g_assert_error (error, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT);
g_assert_null (stdout_str);
- g_assert_cmpint (exit_status, ==, -1);
+ g_assert_cmpint (wait_status, ==, -1);
g_ptr_array_free (argv, TRUE);