24 if (!g_spawn_command_line_sync ("ls", &out
, &err
, &status
, &error
))
25 return FAILED ("Error executing 'ls'");
28 return FAILED ("Status is %d", status
);
30 if (out
== NULL
|| strlen (out
) == 0)
31 return FAILED ("Didn't get any output from ls!?");
43 g_spawn_async_with_pipes (const gchar *working_directory,
47 GSpawnChildSetupFunc child_setup,
51 gint *standard_output,
59 memset (argv
, 0, 15 * sizeof (char *));
61 if (!g_spawn_async_with_pipes (NULL
, argv
, NULL
, G_SPAWN_SEARCH_PATH
, NULL
, NULL
, &child_pid
, NULL
, &stdout_fd
, NULL
, NULL
))
62 return FAILED ("1 Failed to run ls");
64 return FAILED ("2 child pid not returned");
66 return FAILED ("3 out fd is -1");
68 while (read (stdout_fd
, buffer
, 512) > 0);
74 static Test spawn_tests
[] = {
75 {"g_shell_spawn_sync", test_spawn_sync
},
76 {"g_shell_spawn_async_with_pipes", test_spawn_async
},
80 DEFINE_TEST_GROUP_INIT(spawn_tests_init
, spawn_tests
)