oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
72.19k stars 2.58k forks source link

Named Pipe can't be listened to with net.Server.listen() #11820

Open likecyber opened 1 month ago

likecyber commented 1 month ago

What version of Bun is running?

1.1.13-canary.1+bd6a60512

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

What steps can reproduce the bug?

This code works on Node.js but not on Bun.

const net = require('net');
const { spawn } = require('child_process');

const pipePath = '\\\\.\\pipe\\test-named-pipe';

const server = net.createServer((socket) => {
    socket.on('data', (data) => {
        console.log(data);
    });
}).listen(pipePath, () => {
    console.log('Named Pipe is working.');
});

What is the expected behavior?

It should say "Named Pipe is working." if it works as intended.

What do you see instead?

 5 | 
 6 | const server = net.createServer((socket) => {
 7 |     socket.on('data', (data) => {
 8 |         console.log(data);
 9 |     });
10 | }).listen(pipePath, () => {
     ^
error: Failed to listen at \\.\pipe\test-named-pipe
 errno: 2
  code: "ENOENT"

      at listen (native:1:1)
      at listen (node:net:570:9)
      at C:\Bun-Lab\test.js:10:4

Bun v1.1.13-canary.1+bd6a60512 (Windows x64)

Additional information

No response

Zed128 commented 1 month ago

Also have the same problem. I get the same error on the Node-Notifier library