From cba3c47e7fe383c6c3496a55158a86fe6994dd35 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 28 Jun 2010 21:47:43 -0500 Subject: Redirecting output to a file. --- configure.ac | 4 +++- tests/Makefile.am | 1 + tests/test-json-client.c | 11 +++++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index fdc76fb..598df4a 100644 --- a/configure.ac +++ b/configure.ac @@ -62,8 +62,10 @@ AC_SUBST(DBUSMENUGTK_LIBS) ########################### JSON_GLIB_REQUIRED_VERSION=0.6.0 +GIO_UNIX_REQUIRED_VERSION=2.24 -PKG_CHECK_MODULES(DBUSMENUTESTS, json-glib-1.0 >= $JSON_GLIB_REQUIRED_VERSION) +PKG_CHECK_MODULES(DBUSMENUTESTS, json-glib-1.0 >= $JSON_GLIB_REQUIRED_VERSION + gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION) AC_SUBST(DBUSMENUTESTS_CFLAGS) AC_SUBST(DBUSMENUTESTS_LIBS) diff --git a/tests/Makefile.am b/tests/Makefile.am index 3cd4380..1f7e36e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -155,6 +155,7 @@ test_json_client_CFLAGS = \ test_json_client_LDADD = \ ../libdbusmenu-glib/libdbusmenu-glib.la \ + $(DBUSMENUTESTS_LIBS) \ $(DBUSMENUGLIB_LIBS) ###################### diff --git a/tests/test-json-client.c b/tests/test-json-client.c index 7208fa8..62eb87c 100644 --- a/tests/test-json-client.c +++ b/tests/test-json-client.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -36,10 +37,16 @@ main (int argv, char ** argc) g_debug("Initing"); - gchar * command = g_strdup_printf("%s --dbus-name=org.dbusmenu.test --dbus-object=/org/test > %s", argc[1], argc[2]); + gchar * command = g_strdup_printf("%s --dbus-name=org.dbusmenu.test --dbus-object=/org/test", argc[1]); g_debug("Executing: %s", command); - g_spawn_command_line_sync(command, NULL, NULL, NULL, NULL); + gchar * output; + g_spawn_command_line_sync(command, &output, NULL, NULL, NULL); + + GFile * ofile = g_file_new_for_commandline_arg(argc[2]); + if (ofile != NULL) { + g_file_replace_contents(ofile, output, g_utf8_strlen(output, -1), NULL, FALSE, 0, NULL, NULL, NULL); + } g_debug("Exiting"); -- cgit v1.2.3