summaryrefslogtreecommitdiff
path: root/crates/typst-cli
diff options
context:
space:
mode:
authorwznmickey <first@wznmickey.com>2024-11-29 04:21:19 -0500
committerGitHub <noreply@github.com>2024-11-29 09:21:19 +0000
commit3ab131c22ca6e7ef9e28d6352a96bb0846fc608b (patch)
tree60e11d2c13ea97e197d72688e95b761b20f74746 /crates/typst-cli
parent9ce40cb91fd5c6d088c30cc99c3e41e618e6c6fc (diff)
Handle SIGPIPE (#5444)
Diffstat (limited to 'crates/typst-cli')
-rw-r--r--crates/typst-cli/Cargo.toml1
-rw-r--r--crates/typst-cli/src/main.rs4
2 files changed, 5 insertions, 0 deletions
diff --git a/crates/typst-cli/Cargo.toml b/crates/typst-cli/Cargo.toml
index 8f1407d6..4b4abc55 100644
--- a/crates/typst-cli/Cargo.toml
+++ b/crates/typst-cli/Cargo.toml
@@ -46,6 +46,7 @@ serde = { workspace = true }
serde_json = { workspace = true }
serde_yaml = { workspace = true }
shell-escape = { workspace = true }
+sigpipe = { workspace = true }
tar = { workspace = true }
tempfile = { workspace = true }
toml = { workspace = true }
diff --git a/crates/typst-cli/src/main.rs b/crates/typst-cli/src/main.rs
index 631befe5..e4861d6f 100644
--- a/crates/typst-cli/src/main.rs
+++ b/crates/typst-cli/src/main.rs
@@ -44,6 +44,10 @@ static ARGS: LazyLock<CliArguments> = LazyLock::new(|| {
/// Entry point.
fn main() -> ExitCode {
+ // Handle SIGPIPE
+ // https://stackoverflow.com/questions/65755853/simple-word-count-rust-program-outputs-valid-stdout-but-panicks-when-piped-to-he/65760807
+ sigpipe::reset();
+
let res = dispatch();
if let Err(msg) = res {