oven-sh / bun

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

Bun crashes when you try to input JS through its stdin: BrokenPipe #5629

Open jeancahu opened 1 year ago

jeancahu commented 1 year ago

What version of Bun is running?

1.0.2

What platform is your computer?

Linux x86_64

What steps can reproduce the bug?

Convert TS to JS by bun on a new project and try to consume the output by the interpreter bun build index.ts | bun

What is the expected behavior?

bun build index.ts | node Output: Hello via Bun!

What do you see instead?

bun build index.ts | bun Output: Bun: a fast JavaScript runtime, package manager, bundler and test runner. (1.0.2)

run ./my-script.ts Run JavaScript with Bun, a package.json script, or a bin test Run unit tests with Bun x next Install and execute a package bin (bunx) repl Start a REPL session with Bun

init Start an empty Bun project from a blank template create astro Create a new project from a template (bun c)

install Install dependencies for a package.json (bun i) add @zarfjs/zarf Add a dependency to package.json (bun a) remove webpack Remove a dependency from package.json (bun rm) update zod Update outdated dependencies link Link an npm package globally unlink Globally unlink an npm package pm More commands for managing packages

build ./a.ts ./b.jsx Bundle TypeScript & JavaScript into a single file

upgrade Get the latest version of Bun bun --help Show all supported flags and commands

Learn more about Bun: https://bun.sh/docs Join our Discord community: https://bun.sh/discord

error: BrokenPipe

----- bun meta ----- Bun v1.0.2 (37edd5a6) Linux x64 #1 SMP PREEMPT_DYNAMIC Thu, 06 Jul 2023 13:07:19 +0000 BuildCommand: Elapsed: 17ms | User: 3ms | Sys: 3ms RSS: 39.87MB | Peak: 16.87MB | Commit: 39.87MB | Faults: 2 ----- bun meta -----

0 0x55be5be9958b 1 ??? 2 ??? 3 ??? 4 ??? 5 ??? 6 ???

Crash report saved to: ~/.bun/.bun-crash/v1.0.2-1694971856863.crash

Search GitHub issues https://bun.sh/issues or ask for #help in https://bun.sh/discord

Additional information

No response

nektro commented 6 months ago

as of at least Bun 1.1.9 this now gracefully prints error: 'main' returned error.EPIPE and the bun help screen.

support for piping from stdin (albeit with bun -) was added in Bun 1.0.31.

adding support for | bun may be added in the future but wanted to give a status update :)