From f5e4d2fa718c01d9ef4b47e4d5f6f6e430d11ef7 Mon Sep 17 00:00:00 2001 From: Jacob Halsey Date: Mon, 26 Feb 2024 22:17:10 +0000 Subject: [PATCH] don't panic on notify error (#10) --- Cargo.lock | 4 ++-- Cargo.toml | 4 ++-- src/runner.rs | 1 + src/tray.rs | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a9f58cb..f4ad00a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -312,7 +312,7 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "win32-utils" version = "0.1.0" -source = "git+https://github.com/jacob-pro/win32-utils#b3de3551950cd0272c238f518edbc633349bc4c8" +source = "git+https://github.com/jacob-pro/win32-utils?rev=055c60695dbc4d300f3caaacec25ae82415fa545#055c60695dbc4d300f3caaacec25ae82415fa545" dependencies = [ "thiserror", "windows", @@ -437,7 +437,7 @@ checksum = "f4dd6dc7df2d84cf7b33822ed5b86318fb1781948e9663bacd047fc9dd52259d" [[package]] name = "wsl2-dns-agent" -version = "0.3.5" +version = "0.3.6" dependencies = [ "chrono", "configparser", diff --git a/Cargo.toml b/Cargo.toml index cbb4a32..b694bfe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wsl2-dns-agent" -version = "0.3.5" +version = "0.3.6" edition = "2021" license = "GPL-3.0" description = "An agent that automatically patches your WSL2 DNS configuration for users of Cisco AnyConnect (or similar VPNs)" @@ -18,7 +18,7 @@ serde = { version = "1.0.137", features = ["derive"] } simplelog = "0.12.0" thiserror = "1.0.31" toml = "0.5.9" -win32-utils = { git = "https://github.com/jacob-pro/win32-utils", features = ["net", "window", "instance"] } +win32-utils = { git = "https://github.com/jacob-pro/win32-utils", features = ["net", "window", "instance"], rev = "055c60695dbc4d300f3caaacec25ae82415fa545" } [dependencies.windows] version = "0.37.0" diff --git a/src/runner.rs b/src/runner.rs index a419534..330f918 100644 --- a/src/runner.rs +++ b/src/runner.rs @@ -49,6 +49,7 @@ pub fn start_runner(config: Config, rx: mpsc::Receiver, tray: TrayHan } #[derive(Debug, Error)] +#[allow(clippy::enum_variant_names)] enum Error { #[error("Win32 DNS error: {0}")] Dns( diff --git a/src/tray.rs b/src/tray.rs index 9908b3f..6cdd2af 100644 --- a/src/tray.rs +++ b/src/tray.rs @@ -188,7 +188,8 @@ impl TrayProperties { .copy_to_wchar_buffer(&mut self.icon.szInfoTitle) .unwrap(); message.copy_to_wchar_buffer(&mut self.icon.szInfo).unwrap(); - Shell_NotifyIconW(NIM_MODIFY, &self.icon).ok().unwrap(); + // https://github.com/jacob-pro/wsl2-dns-agent/issues/9 + Shell_NotifyIconW(NIM_MODIFY, &self.icon); } unsafe fn show_tray_menu(&self) {