fix(bundle): don't panic on broken pipe (#29706)

`deno bundle main.js | less` and then `Ctrl + C` caused
a panic because of `Broken pipe` error.
This commit is contained in:
Bartek Iwańczuk 2025-06-11 21:05:28 +02:00 committed by GitHub
parent 1a8e5edd0f
commit b64d4cb125
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -233,10 +233,7 @@ pub async fn bundle(
if let Some(stdout) = response.write_to_stdout {
let stdout = replace_require_shim(&String::from_utf8_lossy(&stdout));
#[allow(clippy::print_stdout)]
{
println!("{}", stdout);
}
crate::display::write_to_stdout_ignore_sigpipe(stdout.as_bytes())?;
} else if response.errors.is_empty() {
if bundle_flags.output_dir.is_none()
&& std::env::var("NO_DENO_BUNDLE_HACK").is_err()