You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's possible to add extra stdio streams when spawning a child, bun provides those streams, but no message is received.
Nodejs receives them without issues
To reproduce:
child.js
import{createWriteStream}from'fs';conststdio3=createWriteStream(null,{fd: 3});console.log('stdout: createWriteStream fd: 3')stdio3.write('hi from bun! using fd 3')
index.js
import{spawn}from'child_process';constchild=spawn('bun',['src/child.js'],{stdio: ['inherit','inherit','inherit','pipe']});console.log(`${child.stdio.length} available file descriptors`)child.stdio[3].on('data',d=>console.log(`fd 3: ${d.toString()}`))
What is the expected behavior?
expected nodejs behavior:
$ node src/index.js
4 available file descriptors
stdout: createWriteStream fd: 3
fd 3: hi from bun! using fd 3
What do you see instead?
$ bun src/index.js
4 available file descriptors
stdout: createWriteStream fd: 3
Additional information
Using Bun.spawn, we see that bunSpawn.stdio (which is not documented, at least not in the types)
provides an integer at the position 4: [ null, null, null, 172 ]
I don't know what to do with this value, as passing it to createReadStream(null, {fd:bunSpawn.stdio[3]}) yields no data and instantly closes
What version of Bun is running?
1.1.8-canary.1+88468a2c2
What platform is your computer?
Microsoft Windows NT 10.0.19045.0 x64
What steps can reproduce the bug?
It's possible to add extra stdio streams when spawning a child, bun provides those streams, but no message is received.
Nodejs receives them without issues
To reproduce:
child.js
index.js
What is the expected behavior?
expected nodejs behavior:
What do you see instead?
Additional information
Using Bun.spawn, we see that
bunSpawn.stdio
(which is not documented, at least not in the types)provides an integer at the position 4:
[ null, null, null, 172 ]
I don't know what to do with this value, as passing it to
createReadStream(null, {fd:bunSpawn.stdio[3]})
yields no data and instantly closesThis seems related to #6240
The text was updated successfully, but these errors were encountered: