test: improve output from IPC test helpers

PR-URL: https://github.com/libuv/libuv/pull/1843
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
This commit is contained in:
Bert Belder 2018-05-20 18:59:08 -07:00
parent 4f60e0c1d7
commit b6eb3cef46
No known key found for this signature in database
GPG Key ID: 7A77887B2E2ED461
2 changed files with 10 additions and 7 deletions

View File

@ -25,7 +25,7 @@
#include <stdio.h>
#include <string.h>
/* See test-ipc.ctx */
/* See test-ipc.c */
void spawn_helper(uv_pipe_t* channel,
uv_process_t* process,
const char* helper);

View File

@ -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);