Open
Description
Line 355 in 3105550
This usage appears in libuv's test code. But it is preceded by an assertion.
On Linux this does not throw an error. Everything runs fine.
But on Windows it does not.
uv_pipe_open
will return UV_ENOTSOCK
This results in errors when setting up output redirection for luvit.
code.c
#include <stdio.h>
#include <uv.h>
uv_loop_t* loop = NULL;
void open_done( uv_fs_t* req )
{
if ( req->result < 0 ) {
printf( "error\n" );
return;
}
printf( "result: %lld\n", req->result );
uv_file filed = ( uv_file )req->result;
printf( "%d\n", uv_guess_handle( filed ) );
int ret = 0;
uv_pipe_t pipe = {};
ret = uv_pipe_init( loop, &pipe, 0 );
ret = uv_pipe_open( &pipe, filed );
printf( "pipe_open ret : %d\n", ret );
uv_buf_t b[] = { { .base = "3", .len = 1 }, { .base = "4", .len = 1 } };
uv_try_write( ( void* )&pipe, b, 2 );
uv_os_fd_t pipe_fd = 0;
ret = uv_fileno( ( void* )&pipe, &pipe_fd );
printf( "fileno ret : %d, fd: %p\n", ret, pipe_fd );
}
int main( int argc, char** argv )
{
loop = uv_loop_new();
uv_fs_t file_req;
uv_fs_open( loop, &file_req, argv[ 1 ], O_CREAT | O_RDWR, 0644, open_done );
uv_run( loop, UV_RUN_DEFAULT );
return 0;
}
Metadata
Metadata
Assignees
Labels
No labels