From b6eb3cef463d992c5aa197616f73437dc0342a92 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Sun, 20 May 2018 18:59:08 -0700 Subject: [PATCH] test: improve output from IPC test helpers PR-URL: https://github.com/libuv/libuv/pull/1843 Reviewed-By: Anna Henningsen Reviewed-By: Bartosz Sosnowski Reviewed-By: Gireesh Punathil --- test/test-ipc-send-recv.c | 2 +- test/test-ipc.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/test/test-ipc-send-recv.c b/test/test-ipc-send-recv.c index 7a82cb7e2..3dedc86b8 100644 --- a/test/test-ipc-send-recv.c +++ b/test/test-ipc-send-recv.c @@ -25,7 +25,7 @@ #include #include -/* See test-ipc.ctx */ +/* See test-ipc.c */ void spawn_helper(uv_pipe_t* channel, uv_process_t* process, const char* helper); diff --git a/test/test-ipc.c b/test/test-ipc.c index 88d63d4dc..200f68d60 100644 --- a/test/test-ipc.c +++ b/test/test-ipc.c @@ -281,7 +281,7 @@ void spawn_helper(uv_pipe_t* channel, char exepath[1024]; char* args[3]; int r; - uv_stdio_container_t stdio[1]; + uv_stdio_container_t stdio[3]; r = uv_pipe_init(uv_default_loop(), channel, 1); ASSERT(r == 0); @@ -300,12 +300,15 @@ void spawn_helper(uv_pipe_t* channel, options.file = exepath; options.args = args; options.exit_cb = exit_cb; - options.stdio = stdio; - options.stdio[0].flags = UV_CREATE_PIPE | - UV_READABLE_PIPE | UV_WRITABLE_PIPE; - options.stdio[0].data.stream = (uv_stream_t*)channel; - options.stdio_count = 1; + options.stdio_count = ARRAY_SIZE(stdio); + + stdio[0].flags = UV_CREATE_PIPE | UV_READABLE_PIPE | UV_WRITABLE_PIPE; + stdio[0].data.stream = (uv_stream_t*) channel; + stdio[1].flags = UV_INHERIT_FD; + stdio[1].data.fd = 1; + stdio[2].flags = UV_INHERIT_FD; + stdio[2].data.fd = 2; r = uv_spawn(uv_default_loop(), process, &options); ASSERT(r == 0);