GDBusConnection: don't write to stdout
authorRyan Lortie <desrt@desrt.ca>
Thu, 2 Jan 2014 06:38:07 +0000 (01:38 -0500)
committerRyan Lortie <desrt@desrt.ca>
Thu, 2 Jan 2014 15:08:55 +0000 (10:08 -0500)
When losing the D-Bus connection, we would write to stdout about it just
before killing ourselves with SIGTERM.  We're a library, so we should
probably use stderr instead.

https://bugzilla.gnome.org/show_bug.cgi?id=721324

gio/gdbusconnection.c
gio/tests/gdbus-exit-on-close.c

index fef04a5..43f7c93 100644 (file)
@@ -799,14 +799,14 @@ g_dbus_connection_real_closed (GDBusConnection *connection,
     {
       if (error != NULL)
         {
-          g_print ("%s: Remote peer vanished with error: %s (%s, %d). Exiting.\n",
-                   G_STRFUNC,
-                   error->message,
-                   g_quark_to_string (error->domain), error->code);
+          g_printerr ("%s: Remote peer vanished with error: %s (%s, %d). Exiting.\n",
+                      G_STRFUNC,
+                      error->message,
+                      g_quark_to_string (error->domain), error->code);
         }
       else
         {
-          g_print ("%s: Remote peer vanished. Exiting.\n", G_STRFUNC);
+          g_printerr ("%s: Remote peer vanished. Exiting.\n", G_STRFUNC);
         }
       raise (SIGTERM);
     }
index befad74..c431331 100644 (file)
@@ -191,12 +191,12 @@ test_exit_on_close (gconstpointer test_data)
   if (td->exit_on_close == EXPLICITLY_FALSE ||
       td->who_closes == LOCAL)
     {
-      g_test_trap_assert_stdout_unmatched (VANISHED_PATTERN);
+      g_test_trap_assert_stderr_unmatched (VANISHED_PATTERN);
       g_test_trap_assert_passed ();
     }
   else
     {
-      g_test_trap_assert_stdout (VANISHED_PATTERN);
+      g_test_trap_assert_stderr (VANISHED_PATTERN);
       g_test_trap_assert_failed();
     }
 }