From 950fcf6328f9cf4a1a9c9b5808ce27352ac2f2a3 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 31 Mar 2024 09:10:15 +0400 Subject: Set SIGPIPE to SIG_DFL before printing in niri msg --- src/ipc/client.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ipc/client.rs b/src/ipc/client.rs index 424b243d..97413d0b 100644 --- a/src/ipc/client.rs +++ b/src/ipc/client.rs @@ -43,6 +43,11 @@ pub fn handle_msg(msg: Msg, json: bool) -> anyhow::Result<()> { .map_err(|msg| anyhow!(msg)) .context("niri could not handle the request")?; + // Default SIGPIPE so that our prints don't panic on stdout closing. + unsafe { + libc::signal(libc::SIGPIPE, libc::SIG_DFL); + } + match msg { Msg::Outputs => { let Response::Outputs(outputs) = response else { -- cgit