X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Futil%2Ftest_os_start_process.c;h=599451898051c767088279eed78b17bfb862b179;hb=27520ef39b732562a6c4ffa8640b44250ad72a4a;hp=5b9973250ac93eb89b7d0fa33c006aaa8a4cebe4;hpb=2742cca3d2180b4f615c40609fccf10a806f05c8;p=oweals%2Fgnunet.git diff --git a/src/util/test_os_start_process.c b/src/util/test_os_start_process.c index 5b9973250..599451898 100644 --- a/src/util/test_os_start_process.c +++ b/src/util/test_os_start_process.c @@ -113,7 +113,11 @@ run_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) const struct GNUNET_DISK_FileHandle *stdout_read_handle; const struct GNUNET_DISK_FileHandle *wh; +#if !WINDOWS GNUNET_asprintf (&fn, "cat"); +#else + GNUNET_asprintf (&fn, "w32cat"); +#endif hello_pipe_stdin = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_YES, GNUNET_NO); hello_pipe_stdout = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO, GNUNET_YES); @@ -127,7 +131,7 @@ run_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } proc = - GNUNET_OS_start_process (GNUNET_NO, hello_pipe_stdin, hello_pipe_stdout, fn, + GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn, "test_gnunet_echo_hello", "-", NULL); GNUNET_free (fn); @@ -183,16 +187,24 @@ check_run () static int check_kill () { + char *fn; +#if !WINDOWS + GNUNET_asprintf (&fn, "cat"); +#else + GNUNET_asprintf (&fn, "w32cat"); +#endif hello_pipe_stdin = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_YES, GNUNET_NO); hello_pipe_stdout = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO, GNUNET_YES); if ((hello_pipe_stdout == NULL) || (hello_pipe_stdin == NULL)) { + GNUNET_free (fn); return 1; } proc = - GNUNET_OS_start_process (GNUNET_YES, hello_pipe_stdin, hello_pipe_stdout, "cat", + GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn, "gnunet-service-resolver", "-", NULL); sleep (1); /* give process time to start, so we actually use the pipe-kill mechanism! */ + GNUNET_free (fn); if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (proc)); @@ -210,19 +222,27 @@ check_kill () static int check_instant_kill () { + char *fn; +#if !WINDOWS + GNUNET_asprintf (&fn, "cat"); +#else + GNUNET_asprintf (&fn, "w32cat"); +#endif hello_pipe_stdin = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_YES, GNUNET_NO); hello_pipe_stdout = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO, GNUNET_YES); if ((hello_pipe_stdout == NULL) || (hello_pipe_stdin == NULL)) { + GNUNET_free (fn); return 1; } proc = - GNUNET_OS_start_process (GNUNET_YES, hello_pipe_stdin, hello_pipe_stdout, "cat", + GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn, "gnunet-service-resolver", "-", NULL); if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) { GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); } + GNUNET_free (fn); GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (proc)); GNUNET_OS_process_destroy (proc); proc = NULL;