Set SIGPIPE to SIG_DFL before printing in niri msg
Browse files at this commit950fcf6328f9cf4a1a9c9b5808ce27352ac2f2a3Parent: 7ff2de11 changed file +5 -0
- src/ipc/client.rs +5 -0
src/ipc/client.rsmodified+5 -0
| @@ -43,6 +43,11 @@ pub fn handle_msg(msg: Msg, json: bool) -> anyhow::Result<()> { | |||
| 43 | .map_err(|msg| anyhow!(msg)) | 43 | .map_err(|msg| anyhow!(msg)) |
| 44 | .context("niri could not handle the request")?; | 44 | .context("niri could not handle the request")?; |
| 45 | 45 | ||
| 46 | + // Default SIGPIPE so that our prints don't panic on stdout closing. | ||
| 47 | + unsafe { | ||
| 48 | + libc::signal(libc::SIGPIPE, libc::SIG_DFL); | ||
| 49 | + } | ||
| 50 | + | ||
| 46 | match msg { | 51 | match msg { |
| 47 | Msg::Outputs => { | 52 | Msg::Outputs => { |
| 48 | let Response::Outputs(outputs) = response else { | 53 | let Response::Outputs(outputs) = response else { |