From 874083d5b396b5151ddc12208c85e96d37046dd8 Mon Sep 17 00:00:00 2001 From: Andrew Paprocki Date: Sun, 3 Mar 2019 14:45:56 -0500 Subject: [PATCH] test: change spawn_stdin_stdout return to void The return type is changed to avoid having to craft an artificial `return` just for the Studio compiler. PR-URL: https://github.com/libuv/libuv/pull/2200 Reviewed-By: Ben Noordhuis --- test/run-tests.c | 5 +++-- test/test-spawn.c | 12 ++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/test/run-tests.c b/test/run-tests.c index 522d80c7..55cf4128 100644 --- a/test/run-tests.c +++ b/test/run-tests.c @@ -44,7 +44,7 @@ int ipc_send_recv_helper(void); int ipc_helper_bind_twice(void); int ipc_helper_send_zero(void); int stdio_over_pipes_helper(void); -int spawn_stdin_stdout(void); +void spawn_stdin_stdout(void); int spawn_tcp_server_helper(void); static int maybe_run_test(int argc, char **argv); @@ -211,7 +211,8 @@ static int maybe_run_test(int argc, char **argv) { if (strcmp(argv[1], "spawn_helper9") == 0) { notify_parent_process(); - return spawn_stdin_stdout(); + spawn_stdin_stdout(); + return 1; } #ifndef _WIN32 diff --git a/test/test-spawn.c b/test/test-spawn.c index 1a175825..e5fc308a 100644 --- a/test/test-spawn.c +++ b/test/test-spawn.c @@ -1838,7 +1838,7 @@ TEST_IMPL(spawn_quoted_path) { /* Helper for child process of spawn_inherit_streams */ #ifndef _WIN32 -int spawn_stdin_stdout(void) { +void spawn_stdin_stdout(void) { char buf[1024]; char* pbuf; for (;;) { @@ -1847,7 +1847,7 @@ int spawn_stdin_stdout(void) { r = read(0, buf, sizeof buf); } while (r == -1 && errno == EINTR); if (r == 0) { - return 1; + return; } ASSERT(r > 0); c = r; @@ -1861,12 +1861,9 @@ int spawn_stdin_stdout(void) { c = c - w; } } -#ifndef __SUNPRO_C - return 2; -#endif } #else -int spawn_stdin_stdout(void) { +void spawn_stdin_stdout(void) { char buf[1024]; char* pbuf; HANDLE h_stdin = GetStdHandle(STD_INPUT_HANDLE); @@ -1879,7 +1876,7 @@ int spawn_stdin_stdout(void) { DWORD to_write; if (!ReadFile(h_stdin, buf, sizeof buf, &n_read, NULL)) { ASSERT(GetLastError() == ERROR_BROKEN_PIPE); - return 1; + return; } to_write = n_read; pbuf = buf; @@ -1889,6 +1886,5 @@ int spawn_stdin_stdout(void) { pbuf += n_written; } } - return 2; } #endif /* !_WIN32 */