From c408cebdd4e66e8698b90221fffb8db4429b7482 Mon Sep 17 00:00:00 2001 From: Li Junchen Date: Fri, 15 Nov 2024 11:35:40 +0800 Subject: [PATCH] fix: restore default SIGPIPE behavior --- Cargo.lock | 9 +++++---- crates/moonrun/Cargo.toml | 1 + crates/moonrun/src/main.rs | 5 +++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a1f8c40b..87676261 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -176,9 +176,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.69.4" +version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ "bitflags 2.6.0", "cexpr", @@ -1223,9 +1223,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" [[package]] name = "libloading" @@ -1444,6 +1444,7 @@ dependencies = [ "chrono", "clap", "expect-test", + "libc", "rand", "serde", "serde_json_lenient", diff --git a/crates/moonrun/Cargo.toml b/crates/moonrun/Cargo.toml index 35940854..0fc7514e 100644 --- a/crates/moonrun/Cargo.toml +++ b/crates/moonrun/Cargo.toml @@ -32,6 +32,7 @@ rand = "0.8.5" tracing = "0.1.40" tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } v8 = "0.106.0" +libc = "0.2.162" [build-dependencies] vergen = { version = "8.0.0", features = ["build", "git", "gitcl"] } diff --git a/crates/moonrun/src/main.rs b/crates/moonrun/src/main.rs index 07734f57..3611f5bf 100644 --- a/crates/moonrun/src/main.rs +++ b/crates/moonrun/src/main.rs @@ -510,6 +510,11 @@ struct Commandline { } fn main() -> anyhow::Result<()> { + #[allow(unsafe_code)] + unsafe { + libc::signal(libc::SIGPIPE, libc::SIG_DFL); + } + tracing_subscriber::FmtSubscriber::builder() .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) .compact()