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 <info@bnoordhuis.nl>
This commit is contained in:
parent
7f2d5bc32b
commit
874083d5b3
@ -44,7 +44,7 @@ int ipc_send_recv_helper(void);
|
|||||||
int ipc_helper_bind_twice(void);
|
int ipc_helper_bind_twice(void);
|
||||||
int ipc_helper_send_zero(void);
|
int ipc_helper_send_zero(void);
|
||||||
int stdio_over_pipes_helper(void);
|
int stdio_over_pipes_helper(void);
|
||||||
int spawn_stdin_stdout(void);
|
void spawn_stdin_stdout(void);
|
||||||
int spawn_tcp_server_helper(void);
|
int spawn_tcp_server_helper(void);
|
||||||
|
|
||||||
static int maybe_run_test(int argc, char **argv);
|
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) {
|
if (strcmp(argv[1], "spawn_helper9") == 0) {
|
||||||
notify_parent_process();
|
notify_parent_process();
|
||||||
return spawn_stdin_stdout();
|
spawn_stdin_stdout();
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
|||||||
@ -1838,7 +1838,7 @@ TEST_IMPL(spawn_quoted_path) {
|
|||||||
|
|
||||||
/* Helper for child process of spawn_inherit_streams */
|
/* Helper for child process of spawn_inherit_streams */
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
int spawn_stdin_stdout(void) {
|
void spawn_stdin_stdout(void) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char* pbuf;
|
char* pbuf;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -1847,7 +1847,7 @@ int spawn_stdin_stdout(void) {
|
|||||||
r = read(0, buf, sizeof buf);
|
r = read(0, buf, sizeof buf);
|
||||||
} while (r == -1 && errno == EINTR);
|
} while (r == -1 && errno == EINTR);
|
||||||
if (r == 0) {
|
if (r == 0) {
|
||||||
return 1;
|
return;
|
||||||
}
|
}
|
||||||
ASSERT(r > 0);
|
ASSERT(r > 0);
|
||||||
c = r;
|
c = r;
|
||||||
@ -1861,12 +1861,9 @@ int spawn_stdin_stdout(void) {
|
|||||||
c = c - w;
|
c = c - w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifndef __SUNPRO_C
|
|
||||||
return 2;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
int spawn_stdin_stdout(void) {
|
void spawn_stdin_stdout(void) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char* pbuf;
|
char* pbuf;
|
||||||
HANDLE h_stdin = GetStdHandle(STD_INPUT_HANDLE);
|
HANDLE h_stdin = GetStdHandle(STD_INPUT_HANDLE);
|
||||||
@ -1879,7 +1876,7 @@ int spawn_stdin_stdout(void) {
|
|||||||
DWORD to_write;
|
DWORD to_write;
|
||||||
if (!ReadFile(h_stdin, buf, sizeof buf, &n_read, NULL)) {
|
if (!ReadFile(h_stdin, buf, sizeof buf, &n_read, NULL)) {
|
||||||
ASSERT(GetLastError() == ERROR_BROKEN_PIPE);
|
ASSERT(GetLastError() == ERROR_BROKEN_PIPE);
|
||||||
return 1;
|
return;
|
||||||
}
|
}
|
||||||
to_write = n_read;
|
to_write = n_read;
|
||||||
pbuf = buf;
|
pbuf = buf;
|
||||||
@ -1889,6 +1886,5 @@ int spawn_stdin_stdout(void) {
|
|||||||
pbuf += n_written;
|
pbuf += n_written;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 2;
|
|
||||||
}
|
}
|
||||||
#endif /* !_WIN32 */
|
#endif /* !_WIN32 */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user