mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 07:26:15 +01:00
e0b6b8037d
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(): conceptually it's an integer encoding of this tagged union: enum { EXITED, SIGNALLED, ... } tag; union { int exit_status; /* if EXITED */ struct { int terminating_signal; bool core_dumped; } terminating_signal; /* if SIGNALLED */ ... } detail; Meanwhile, on Windows, wait statuses and exit statuses are interchangeable. 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; so let's deprecate it in favour of g_spawn_check_wait_status(), which does the same thing that g_spawn_check_exit_status() always did. Code that needs backwards-compatibility with older GLib can use: #if !GLIB_CHECK_VERSION(2, 69, 0) #define g_spawn_check_wait_status(x) (g_spawn_check_exit_status (x)) #endif Signed-off-by: Simon McVittie <smcv@collabora.com> |
||
---|---|---|
.. | ||
reference | ||
CODEOWNERS | ||
debugging.txt | ||
macros.txt |