[evolution-data-server] test-server-utils: Don't rely on command line parsing for "rm -rf"
- From: Mathias Hasselmann <hasselmm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] test-server-utils: Don't rely on command line parsing for "rm -rf"
- Date: Wed, 19 Dec 2012 00:44:44 +0000 (UTC)
commit c7d1aab943024805cf5c4346b0a75ebeb30b0a00
Author: Mathias Hasselmann <mathias openismus com>
Date: Wed Dec 19 01:41:59 2012 +0100
test-server-utils: Don't rely on command line parsing for "rm -rf"
Let's be nice to people with spaces in their path names.
tests/test-server-utils/e-test-server-utils.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/tests/test-server-utils/e-test-server-utils.c b/tests/test-server-utils/e-test-server-utils.c
index 99c5347..8456131 100644
--- a/tests/test-server-utils/e-test-server-utils.c
+++ b/tests/test-server-utils/e-test-server-utils.c
@@ -60,8 +60,6 @@ setup_environment (void)
static void
delete_work_directory (void)
{
- gchar *command_line;
-
/* XXX Instead of complex error checking here, we should ideally use
* a recursive GDir / g_unlink() function.
*
@@ -69,9 +67,16 @@ delete_work_directory (void)
* corrupting our contained D-Bus environment with service files
* from the OS.
*/
- command_line = g_strdup_printf ("/bin/rm -rf %s", EDS_TEST_WORK_DIR);
- g_spawn_command_line_sync (command_line, NULL, NULL, NULL, NULL);
- g_free (command_line);
+ const gchar *argv[] = { "/bin/rm", "-rf", EDS_TEST_WORK_DIR, NULL };
+ gboolean spawn_succeeded;
+ gint exit_status;
+
+ spawn_succeeded = g_spawn_sync (NULL, (char **) argv, NULL, 0, NULL, NULL,
+ NULL, NULL, &exit_status, NULL);
+
+ g_assert (spawn_succeeded);
+ g_assert (WIFEXITED (exit_status));
+ g_assert_cmpint (WEXITSTATUS (exit_status), ==, 0);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]