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. --- tests/test-json-client.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tests/test-json-client.c') 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