help icon indicating copy to clipboard operation
help copied to clipboard

cause error in uv_pipe_open(stdin/stdout)

Open jc-lab opened this issue 4 years ago • 6 comments

  • Version: Many versions (Maybe all)...
  • Platform: Windows 10 1903

Same error : https://groups.google.com/forum/#!msg/libuv/iYmwxzRyemU/BBDeikdBBAAJ

int main(int argc, char **argv) {
    loop = uv_default_loop();

    uv_pipe_init(loop, &stdin_pipe, 0);
    uv_pipe_open(&stdin_pipe, 0); // <---------- return UV_EINVAL

    uv_pipe_init(loop, &stdout_pipe, 0);
    uv_pipe_open(&stdout_pipe, 1);
    
    uv_fs_t file_req;
    int fd = uv_fs_open(loop, &file_req, argv[1], O_CREAT | O_RDWR, 0644, NULL);
    uv_pipe_init(loop, &file_pipe, 0);
    uv_pipe_open(&file_pipe, fd);

    uv_read_start((uv_stream_t*)&stdin_pipe, alloc_buffer, read_stdin);

    uv_run(loop, UV_RUN_DEFAULT);
    return 0;
}

Seems like a long time ago. Still not fixed?

jc-lab avatar Dec 27 '19 02:12 jc-lab