An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
Rust androidanydeskdartflatpakflutterflutter-appsioslinuxmacosp2prdpremote-controlremote-desktoprustrust-langteamviewervncwaylandwindows
refact: remote printer, log (#11271)
fufesou4b14f8613461
diff --git a/src/client/io_loop.rs b/src/client/io_loop.rsindex bca9badd4..31810644e 100644--- a/src/client/io_loop.rs+++ b/src/client/io_loop.rs@@ -1569,11 +1569,14 @@ impl<T: InvokeUiSession> Remote<T> {// Spawn a new thread to handle the print job.// Or print job will block the ui thread.std::thread::spawn(move || {- crate::platform::send_raw_data_to_printer(- printer_name,- data,- )- .ok();+ if let Err(e) =+ crate::platform::send_raw_data_to_printer(+ printer_name,+ data,+ )+ {+ log::error!("Print job error: {}", e);+ }});}}diff --git a/src/platform/windows.rs b/src/platform/windows.rsindex ed2b71c5d..2c89b49fb 100644--- a/src/platform/windows.rs+++ b/src/platform/windows.rs@@ -2862,19 +2862,15 @@ pub fn send_raw_data_to_printer(printer_name: Option<String>, data: Vec<u8>) ->if !names.contains(&printer_name) {// Don't set the first printer as current printer.// It may not be the desired printer.- log::error!(- "Printer name \"{}\" not found, ignore the print job",- printer_name- );bail!("Printer name \"{}\" not found", &printer_name);}}}if printer_name.is_empty() {- log::error!("Failed to get printer name");return Err(anyhow!("Failed to get printer name"));}+ log::info!("Sending data to printer: {}", &printer_name);let printer_name = wide_string(&printer_name);unsafe {let res = PrintXPSRawData(@@ -2883,7 +2879,9 @@ pub fn send_raw_data_to_printer(printer_name: Option<String>, data: Vec<u8>) ->data.len() as c_ulong,);if res != 0 {- bail!("Failed to send file to printer, see logs in C:\\Windows\\temp\\test_rustdesk.log for more details.");+ bail!("Failed to send data to the printer, see logs in C:\\Windows\\temp\\test_rustdesk.log for more details.");+ } else {+ log::info!("Successfully sent data to the printer");}}