Skip to content

\x01 byte written to child process  #13799

@mattfysh

Description

@mattfysh

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 })

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingbun:spawnnode.jsCompatibility with Node.js APIs

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions