Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

fix(unix): ignore SIGPIPE in native Flutter entry (#16322)

RustDesk68a35e65f228
diff --git a/src/flutter.rs b/src/flutter.rs
index 5c453d468..cd1f1567d 100644
--- a/src/flutter.rs
+++ b/src/flutter.rs
@@ -105,6 +105,16 @@ fn load_plugin_in_app_path(dll_name: &str) -> Result<Library, LibError> {
#[cfg(not(windows))]
#[no_mangle]
pub extern "C" fn rustdesk_core_main() -> bool {
+ #[cfg(any(target_os = "linux", target_os = "macos"))]
+ {
+ use hbb_common::libc;
+
+ // Native runners bypass Rust's startup, which normally ignores SIGPIPE.
+ if unsafe { libc::signal(libc::SIGPIPE, libc::SIG_IGN) } == libc::SIG_ERR {
+ eprintln!("Failed to ignore SIGPIPE: {}", std::io::Error::last_os_error());
+ std::process::exit(1);
+ }
+ }
#[cfg(not(any(target_os = "android", target_os = "ios")))]
if crate::core_main::core_main().is_some() {
return true;