Skip to content

Commit 915b76d

Browse files
committed
Fix more GLib annoyances
1 parent 9cfa7b6 commit 915b76d

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/appimagetool.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -624,19 +624,11 @@ main (int argc, char *argv[])
624624
int exit_status = -1;
625625

626626
// g_spawn_command_line_sync returns whether the program succeeded
627-
gint ret = g_spawn_command_line_sync(command_line, &out, NULL, &exit_status, &error);
628-
629-
if (ret != 0 || error != NULL) {
630-
// g_spawn_command_line_sync might have set error already, in that case we don't want to overwrite
631-
if (error == NULL) {
632-
// to get a proper error message, we now fetch the message via the returned exit code
633-
// the call returns false if the call failed, and this is what we expect to have happened
634-
// hence we can assume that there must be an error in GLib if it returned true
635-
if (g_spawn_check_exit_status(exit_status, &error)) {
636-
g_printerr("Failed to run 'git rev-parse --short HEAD, but GLib says the process didn't exit abnormally");
637-
}
638-
}
627+
// its return value is buggy, hence we're using g_spawn_check_exit_status to check for errors
628+
g_spawn_command_line_sync(command_line, &out, NULL, &exit_status, &error);
639629

630+
// g_spawn_command_line_sync might have set error already, in that case we don't want to overwrite
631+
if (error != NULL || !g_spawn_check_exit_status(exit_status, &error)) {
640632
if (error == NULL) {
641633
g_printerr("Failed to run 'git rev-parse --short HEAD, but failed to interpret GLib error state: %d\n", exit_status);
642634
} else {

0 commit comments

Comments
 (0)