core: Use g_spawn_check_exit_status()
This commit is contained in:
1 parent
6b31c580ca
commit
c8d7fc216d
1 file changed
+1
-21
@@ -25,7 +25,6 @@
|
|||||||
#include "otutil.h"
|
#include "otutil.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/wait.h>
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
ot_spawn_sync_checked (const char *cwd,
|
ot_spawn_sync_checked (const char *cwd,
|
||||||
@@ -50,27 +49,8 @@ ot_spawn_sync_checked (const char *cwd,
|
|||||||
error))
|
error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (WIFEXITED (exit_status))
|
if (!g_spawn_check_exit_status (exit_status, error))
|
||||||
{
|
|
||||||
if (WEXITSTATUS (exit_status) != 0)
|
|
||||||
{
|
|
||||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
|
||||||
"Exited with code %d", WEXITSTATUS (exit_status));
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (WIFSIGNALED (exit_status))
|
|
||||||
{
|
|
||||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
|
||||||
"Killed by signal %d", WTERMSIG (exit_status));
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
|
||||||
"Exited abnormally");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
out:
|
out:
|
||||||
|
|||||||
Reference in new issue
Block a user