win,unix: add uv_pipe_open_ex - #5160
Closed
PickBas wants to merge 1 commit into
Closed
Conversation
uv_pipe_open() interprets its argument as a CRT file descriptor on Windows, so a raw HANDLE without one (e.g. an inherited anonymous pipe) fails. uv_pipe_open_ex() accepts the native OS handle directly. On Unix it is equivalent to uv_pipe_open(). Refs: nodejs/node#57288 Signed-off-by: PickBas <sayed.kirill@gmail.com>
Member
|
Not sure this is necessary, since it has been available in v2 for many years now. Notably we already provide |
Member
|
Legacy consumers of v1.x (mainly nodejs) also have the option of calling |
Author
|
Appreciate the feedback. I'm closing this PR in favor of nodejs/node#63851 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
win,unix: add uv_pipe_open_ex
Adds
uv_pipe_open_ex(), which opens a pipe from a native OS handle (HANDLEon Windows, file descriptor on Unix).On Windows,
uv_pipe_open()interprets its argument as a CRT file descriptor via_get_osfhandle(). A rawHANDLEwith no CRT fd, e.g. an inherited anonymous pipe handle (CreatePipe, .NETAnonymousPipeServerStream), fails withUV_EBADF, and no workaround exists since CRT fds are not inheritable. Implements the approach suggested in this comment. On Unix the call is equivalent touv_pipe_open().The handle is owned by libuv after a successful call; on failure it remains owned by the caller. Test covers a raw
CreatePipe()handle (no CRT fd, non-overlapped) on Windows.Refs: nodejs/node#57288