Skip to content

Commit

Permalink
Upgrade libuv to 023f99a
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Aug 1, 2011
1 parent f0f941a commit 8da4831
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
25 changes: 13 additions & 12 deletions deps/uv/src/uv-unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1838,6 +1838,7 @@ int uv_pipe_init(uv_pipe_t* handle) {
ev_init(&handle->read_watcher, uv__stream_io);
handle->write_watcher.data = handle;
handle->read_watcher.data = handle;
handle->accepted_fd = -1;
handle->fd = -1;

ngx_queue_init(&handle->write_completed_queue);
Expand Down Expand Up @@ -2308,17 +2309,17 @@ int uv_spawn(uv_process_t* process, uv_process_options_t options) {

if (pid == 0) {
if (stdin_pipe[0] >= 0) {
close(stdin_pipe[1]);
uv__close(stdin_pipe[1]);
dup2(stdin_pipe[0], STDIN_FILENO);
}

if (stdout_pipe[1] >= 0) {
close(stdout_pipe[0]);
uv__close(stdout_pipe[0]);
dup2(stdout_pipe[1], STDOUT_FILENO);
}

if (stderr_pipe[1] >= 0) {
close(stderr_pipe[0]);
uv__close(stderr_pipe[0]);
dup2(stderr_pipe[1], STDERR_FILENO);
}

Expand Down Expand Up @@ -2353,23 +2354,23 @@ int uv_spawn(uv_process_t* process, uv_process_options_t options) {
if (stdin_pipe[1] >= 0) {
assert(options.stdin_stream);
assert(stdin_pipe[0] >= 0);
close(stdin_pipe[0]);
uv__close(stdin_pipe[0]);
uv__nonblock(stdin_pipe[1], 1);
uv__stream_open((uv_stream_t*)options.stdin_stream, stdin_pipe[1]);
}

if (stdout_pipe[0] >= 0) {
assert(options.stdout_stream);
assert(stdout_pipe[1] >= 0);
close(stdout_pipe[1]);
uv__close(stdout_pipe[1]);
uv__nonblock(stdout_pipe[0], 1);
uv__stream_open((uv_stream_t*)options.stdout_stream, stdout_pipe[0]);
}

if (stderr_pipe[0] >= 0) {
assert(options.stderr_stream);
assert(stderr_pipe[1] >= 0);
close(stderr_pipe[1]);
uv__close(stderr_pipe[1]);
uv__nonblock(stderr_pipe[0], 1);
uv__stream_open((uv_stream_t*)options.stderr_stream, stderr_pipe[0]);
}
Expand All @@ -2378,12 +2379,12 @@ int uv_spawn(uv_process_t* process, uv_process_options_t options) {

error:
uv_err_new((uv_handle_t*)process, errno);
close(stdin_pipe[0]);
close(stdin_pipe[1]);
close(stdout_pipe[0]);
close(stdout_pipe[1]);
close(stderr_pipe[0]);
close(stderr_pipe[1]);
uv__close(stdin_pipe[0]);
uv__close(stdin_pipe[1]);
uv__close(stdout_pipe[0]);
uv__close(stdout_pipe[1]);
uv__close(stderr_pipe[0]);
uv__close(stderr_pipe[1]);
return -1;
}

Expand Down
5 changes: 3 additions & 2 deletions deps/uv/test/run-tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ int main(int argc, char **argv) {
}

if (strcmp(argv[1], "spawn_helper3") == 0) {
gets(buffer);
printf(buffer);
fgets(buffer, sizeof(buffer) - 1, stdin);
buffer[sizeof(buffer) - 1] = '\0';
fputs(buffer, stdout);
return 1;
}

Expand Down

0 comments on commit 8da4831

Please sign in to comment.