clipboard: downgrade error logging to debug for expected failures

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ic1cca0d0212b9b3611da8ca3f9c6fb326a6a6964
This commit is contained in:
raf 2026-05-03 17:19:24 +03:00
commit cf207d0a3d
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
3 changed files with 11 additions and 10 deletions

View file

@ -196,8 +196,7 @@ fn serve_clipboard_child(prepared: PreparedCopy) {
}, },
Err(e) => { Err(e) => {
log::error!("clipboard persistence: serve failed: {e}"); log::debug!("clipboard persistence: serve ended: {e}");
exit(1);
}, },
} }
} }

View file

@ -222,8 +222,7 @@ fn fork_and_serve(prepared_copy: wl_clipboard_rs::copy::PreparedCopy) {
0 => { 0 => {
// Child process - serve clipboard content // Child process - serve clipboard content
if let Err(e) = prepared_copy.serve() { if let Err(e) = prepared_copy.serve() {
log::error!("background clipboard service failed: {e}"); log::debug!("background clipboard service ended: {e}");
std::process::exit(1);
} }
std::process::exit(0); std::process::exit(0);
}, },

View file

@ -456,6 +456,9 @@ fn handle_regular_paste(
bail!("no content available and --no-newline specified"); bail!("no content available and --no-newline specified");
} }
if let Err(e) = out.write_all(&buf) { if let Err(e) = out.write_all(&buf) {
if e.kind() == io::ErrorKind::BrokenPipe {
return Ok(());
}
bail!("failed to write to stdout: {e}"); bail!("failed to write to stdout: {e}");
} }
@ -471,13 +474,13 @@ fn handle_regular_paste(
|| types == "application/x-sh" || types == "application/x-sh"
}; };
if !args.no_newline if !args.no_newline && is_text_content && !buf.ends_with(b"\n") {
&& is_text_content if let Err(e) = out.write_all(b"\n") {
&& !buf.ends_with(b"\n") if e.kind() != io::ErrorKind::BrokenPipe {
&& let Err(e) = out.write_all(b"\n")
{
bail!("failed to write newline to stdout: {e}"); bail!("failed to write newline to stdout: {e}");
} }
}
}
}, },
Err(PasteError::NoSeats) => { Err(PasteError::NoSeats) => {
bail!("no seats available (is a Wayland compositor running?)"); bail!("no seats available (is a Wayland compositor running?)");