Do not leak child processes when cancelling

See https://github.com/fwupd/fwupd/pull/4372
This commit is contained in:
Richard Hughes 2022-03-14 20:39:35 +00:00
parent b4e88bae49
commit e8f0d76da7

View File

@ -838,10 +838,16 @@ fu_common_spawn_sync(const gchar *const *argv,
fu_common_spawn_create_pollable_source(helper);
g_main_loop_run(helper->loop);
g_cancellable_disconnect(cancellable, cancellable_id);
#endif
if (!g_subprocess_wait_check(subprocess, cancellable, error))
return FALSE;
#ifndef _WIN32
if (g_cancellable_set_error_if_cancelled(helper->cancellable, error))
return FALSE;
#endif
return g_subprocess_wait_check(subprocess, cancellable, error);
/* success */
return TRUE;
}
/**