aboutsummaryrefslogtreecommitdiff
path: root/tests/test-json-client.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-06-28 21:47:43 -0500
committerTed Gould <ted@gould.cx>2010-06-28 21:47:43 -0500
commitcba3c47e7fe383c6c3496a55158a86fe6994dd35 (patch)
treee805a8c1d237ff86fe25546ada3db9b231e67462 /tests/test-json-client.c
parentdce233d4c70e90cfb0f3862ba66538222ffbb7d6 (diff)
downloadlibdbusmenu-cba3c47e7fe383c6c3496a55158a86fe6994dd35.tar.gz
libdbusmenu-cba3c47e7fe383c6c3496a55158a86fe6994dd35.tar.bz2
libdbusmenu-cba3c47e7fe383c6c3496a55158a86fe6994dd35.zip
Redirecting output to a file.
Diffstat (limited to 'tests/test-json-client.c')
-rw-r--r--tests/test-json-client.c11
1 files changed, 9 insertions, 2 deletions
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 <glib.h>
+#include <gio/gio.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-bindings.h>
#include <dbus/dbus-glib-lowlevel.h>
@@ -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");