oven-sh / bun

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

Bun can't read file descriptors #7102

Open anru opened 10 months ago

anru commented 10 months ago

What version of Bun is running?

1.0.11

What platform is your computer?

Darwin 22.6.0 x86_64 i386

What steps can reproduce the bug?

Run in console bun <(echo "console.log('hello')")

What is the expected behavior?

Command prints hello to stdout.

What do you see instead?

error: script not found "/dev/fd/13"

Additional information

image
SeedyROM commented 10 months ago

The issue you're actually dealing with here is that bun doesn't read pipes/FIFO streams as modules to load, I also don't think it's following symlinks for the given file descriptor (which is a symlink to a symlink of a pipe, eg. https://github.com/nodejs/node/issues/18255#issuecomment-358991562). If you use the synchronous process substitution like so it works:

$ bun =(echo "console.log('hello')")
hello

More info: https://superuser.com/questions/1059781/what-exactly-is-in-bash-and-in-zsh