-
Notifications
You must be signed in to change notification settings - Fork 5.6k
feat(net): named pipe support via Deno.pipe
#29308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Help WantedI encountered an issue when working on the node compat: import * as net from 'node:net'
// I have a server listening on this pipe
// ```ts
// const pipe = Deno.pipe.listen({ path: "\\\\.\\pipe\\mypipe1", kind: "windows", pipeMode: "byte" })
// const ab = new Uint8Array(32)
// await pipe.read(ab); // didn't resolve, it resolve to null after the other side closed :skull:
// ```
const conn = new net.createConnection({ path: "\\\\.\\pipe\\mypipe1" })
conn.write("something") // `true`, but do nothing
// if you await here, it will stuck here
/*await */ Deno[Deno.internal].core.write(
/*
If you createConnection immediately after start,
the pipe resource should be assigned a rid of 3
*/
3,
new TextEncoder().encode("test")
) I tried to write it directly via Resource Id, but the promise never resolves, The The Problem Only Appear In Windows (Because the issue aim to support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, the implementation looks reasonable to me. I'm less sure about the public API changes and the pipe_wrap changes for windows. The pipe_wrap changes seem ok at a glance.
I think the team will have to discuss the new API, and then go from there.
ext/net/win_pipe.rs
Outdated
match &mut *inner { | ||
Inner::Server((ref mut connected, server)) => { | ||
if !*connected { | ||
server.connect().await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why wait to connect until read/write is called? I assume it's related to the todo in new_server
?
41c871d
to
e281862
Compare
Signed-off-by: Cyan <[email protected]>
close #10244
Support Named Pipes via
Deno.pipe
todos
verify if work in windows (I have no Windows dev machine rn)
update
deno_node
to useDeno.pipe
for Windows- close Not implemented: Pipe.prototype.connect #28332
- close Uncaught Error: Not implemented: Pipe.prototype.listen - Windows #25867
type definitions
add tests