Index: gmain.c
===================================================================
--- gmain.c	(revision 7903)
+++ gmain.c	(working copy)
@@ -3564,6 +3564,8 @@ g_child_watch_check (GSource  *source)
 
 #else /* G_OS_WIN32 */
 
+#define DBG(msg) write(STDERR_FILENO, msg "\n", sizeof(msg))
+
 static gboolean
 check_for_child_exited (GSource *source)
 {
@@ -3576,19 +3578,31 @@ check_for_child_exited (GSource *source)
   child_watch_source = (GChildWatchSource *) source;
 
   if (child_watch_source->child_exited)
-    return TRUE;
+    {
+      DBG("check_for_child_exited child_exited");
+      return TRUE;
+    }
 
   if (child_watch_source->count < count)
     {
       gint child_status;
+      int rv;
 
-      if (waitpid (child_watch_source->pid, &child_status, WNOHANG) > 0)
+      rv = waitpid (child_watch_source->pid, &child_status, WNOHANG);
+      if (rv > 0)
 	{
+          DBG("check_for_child_exited > 0");
 	  child_watch_source->child_status = child_status;
 	  child_watch_source->child_exited = TRUE;
 	}
+      else if (rv == 0)
+        DBG("check_for_child_exited == 0");
+      else
+        DBG("check_for_child_exited < 0");
       child_watch_source->count = count;
     }
+  else
+    DBG("check_for_child_exited count < count");
 
   return child_watch_source->child_exited;
 }
@@ -3643,12 +3657,14 @@ g_child_watch_signal_handler (int signum)
 
   if (child_watch_init_state == CHILD_WATCH_INITIALIZED_THREADED)
     {
+      DBG("g_child_watch_signal_handler threaded");
       write (child_watch_wake_up_pipe[1], "B", 1);
     }
   else
     {
       /* We count on the signal interrupting the poll in the same thread.
        */
+        DBG("g_child_watch_signal_handler single");
     }
 }
  
@@ -3676,6 +3692,7 @@ child_watch_helper_thread (gpointer data)
       gchar b[20];
       GSList *list;
 
+      DBG("child_watch_helper_thread");
       read (child_watch_wake_up_pipe[0], b, 20);
 
       /* We were woken up.  Wake up all other contexts in all other threads */
Index: gtester.c
===================================================================
--- gtester.c	(revision 7903)
+++ gtester.c	(working copy)
@@ -241,6 +241,7 @@ child_watch_cb (GPid     pid,
 		gint     status,
 		gpointer data)
 {
+  fprintf(stderr, "child_watch_cb\n");
   g_spawn_close_pid (pid);
   if (WIFEXITED (status)) /* normal exit */
     subtest_exitstatus = WEXITSTATUS (status);
@@ -266,6 +267,8 @@ unset_cloexec_fdp (gpointer fdp_data)
   while (r < 0 && errno == EINTR);
 }
 
+#define DBG(msg) write(STDERR_FILENO, msg "\n", sizeof(msg))
+
 static gboolean
 launch_test_binary (const char *binary,
                     guint       skip_tests)
@@ -345,6 +348,7 @@ launch_test_binary (const char *binary,
     argv[i++] = queue_gfree (&free_list, g_strdup_printf ("-p=%s", (gchar*) slist->data));
   argv[i++] = NULL;
 
+  DBG("g_spawn_async_with_pipes..");
   g_spawn_async_with_pipes (NULL, /* g_get_current_dir() */
                             (gchar**) argv,
                             NULL, /* envp */
@@ -355,6 +359,7 @@ launch_test_binary (const char *binary,
                             NULL,       /* standard_output */
                             NULL,       /* standard_error */
                             &error);
+  DBG("returned from g_spawn_async_with_pipes");
   g_slist_foreach (free_list, (void(*)(void*,void*)) g_free, NULL);
   g_slist_free (free_list);
   free_list = NULL;
@@ -389,6 +394,7 @@ launch_test_binary (const char *binary,
       g_io_channel_unref (ioc_report);
     }
   g_child_watch_add_full (G_PRIORITY_DEFAULT + 1, pid, child_watch_cb, NULL, NULL);
+  DBG("g_child_watch_add_full");
 
   loop_pending = g_main_context_pending (NULL);
   while (subtest_running ||     /* FALSE once child exits */
