mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-02-16 19:00:39 +01:00
test-utils-glib: Wait for the killed process to exit
Otherwise, removing transient service directories that are being watched by the dbus-daemon can fail with EAGAIN. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=99825 Reviewed-by: Philip Withnall <withnall@endlessm.com> Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
This commit is contained in:
parent
06904a8d96
commit
ec9d39b95c
1 changed files with 19 additions and 0 deletions
|
|
@ -418,9 +418,25 @@ test_connect_to_bus_as_user (TestMainContext *ctx,
|
|||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
pid_died (GPid pid,
|
||||
gint status,
|
||||
gpointer user_data)
|
||||
{
|
||||
gboolean *result = user_data;
|
||||
|
||||
g_assert (result != NULL);
|
||||
g_assert (!*result);
|
||||
*result = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
test_kill_pid (GPid pid)
|
||||
{
|
||||
gint died = FALSE;
|
||||
|
||||
g_child_watch_add (pid, pid_died, &died);
|
||||
|
||||
#ifdef DBUS_WIN
|
||||
if (pid != NULL)
|
||||
TerminateProcess (pid, 1);
|
||||
|
|
@ -428,6 +444,9 @@ test_kill_pid (GPid pid)
|
|||
if (pid > 0)
|
||||
kill (pid, SIGTERM);
|
||||
#endif
|
||||
|
||||
while (!died)
|
||||
g_main_context_iteration (NULL, TRUE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue