-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Closed
Labels
bugSomething isn't workingSomething isn't workingbun:spawnnode.jsCompatibility with Node.js APIsCompatibility with Node.js APIs
Description
What version of Bun is running?
1.1.27+267afa293
What platform is your computer?
Darwin 23.6.0 arm64 arm
What steps can reproduce the bug?
index.ts
import { spawn } from 'bun'
const proc = spawn({
cmd: ['python3', 'child.py'],
serialization: 'json',
stdio: ['inherit', 'inherit', 'inherit'],
ipc(msg) {},
})
proc.send({ test: true })
child.py
import os
fd = 3
read_pipe = os.fdopen(fd, "r")
line = read_pipe.readline().strip()
print("recv: ", line.encode())
What is the expected behavior?
recv: b'{"test":true}'
What do you see instead?
Note the \x01
byte
recv: b'\x01{"test":true}'
Additional information
The following code run with node produces the correct result:
import { spawn } from 'node:child_process'
const proc = spawn('python3', ['child.py'], {
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
})
proc.send({ test: true })
rossanmol and amjed-ali-k
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingbun:spawnnode.jsCompatibility with Node.js APIsCompatibility with Node.js APIs