mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 07:23:41 +02:00
Add g_spawn_check_exit_status()
Many (if not "almost all") programs that spawn other programs via g_spawn_sync() or the like simply want to check whether or not the child exited successfully, but doing so requires use of platform-specific functionality and there's actually a fair amount of boilerplate involved. This new API will help drain a *lot* of mostly duplicated code in GNOME, from gnome-session to gdm. And we can see that some bits even inside GLib were doing it wrong; for example checking the exit status on Unix, but ignoring it on Windows. https://bugzilla.gnome.org/show_bug.cgi?id=679691
This commit is contained in:
@@ -26,7 +26,6 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#ifdef HAVE_CRT_EXTERNS_H
|
||||
#include <crt_externs.h>
|
||||
@@ -1850,8 +1849,7 @@ update_program_done (GPid pid,
|
||||
gpointer data)
|
||||
{
|
||||
/* Did the application exit correctly */
|
||||
if (WIFEXITED (status) &&
|
||||
WEXITSTATUS (status) == 0)
|
||||
if (g_spawn_check_exit_status (status, NULL))
|
||||
{
|
||||
/* Here we could clean out any caches in use */
|
||||
}
|
||||
|
Reference in New Issue
Block a user