Index: policykit-1-0.96/src/polkitagent/polkitagentsession.c =================================================================== --- policykit-1-0.96.orig/src/polkitagent/polkitagentsession.c 2010-09-30 13:31:20.000000000 -0400 +++ policykit-1-0.96/src/polkitagent/polkitagentsession.c 2010-09-30 13:47:13.000000000 -0400 @@ -305,9 +305,14 @@ gpointer user_data) { PolkitAgentSession *session = POLKIT_AGENT_SESSION (user_data); + GMainContext *context = g_main_context_default(); /* kill all the watches we have set up, except for the child since it has exited already */ session->child_pid = 0; + /* Allow the stdout of the child to be processed if we haven't finished yet */ + while (g_main_context_pending(context)) { + g_main_context_iteration(context, FALSE); + } kill_helper (session); } @@ -518,9 +523,9 @@ session->helper_is_running = TRUE; - session->child_watch_id = g_child_watch_add (session->child_pid, child_watch_func, session); session->child_stdout_channel = g_io_channel_unix_new (session->child_stdout); session->child_stdout_watch_id = g_io_add_watch (session->child_stdout_channel, G_IO_IN, io_watch_have_data, session); + session->child_watch_id = g_child_watch_add (session->child_pid, child_watch_func, session); return;