15 if (!g_spawn_command_line_sync ("ls", &out, &err, &status, &error))
16 return FAILED ("Error executing 'ls'");
19 return FAILED ("Status is %d", status);
21 if (out == NULL || strlen (out) == 0)
22 return FAILED ("Didn't get any output from ls!?");
34 g_spawn_async_with_pipes (const gchar *working_directory,
38 GSpawnChildSetupFunc child_setup,
42 gint *standard_output,
50 memset (argv, 0, 15 * sizeof (char *));
52 if (!g_spawn_async_with_pipes (NULL, argv, NULL, 0, NULL, NULL, &child_pid, NULL, &stdout_fd, NULL, NULL))
53 return FAILED ("1 Failed to run ls");
55 return FAILED ("2 child pid not returned");
57 return FAILED ("3 out fd is -1");
59 while (read (stdout_fd, buffer, 512) > 0);
61 printf ("Child pid: %d\n", child_pid);
66 static Test spawn_tests [] = {
67 {"g_shell_spawn_sync", test_spawn_sync},
68 {"g_shell_spawn_async_with_pipes", test_spawn_async},
72 DEFINE_TEST_GROUP_INIT(spawn_tests_init, spawn_tests)