Skip to content

Commit a3db647

Browse files
authored
fix: autolauncher-edge-case (#1587)
Fixes #1586 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Enhanced error handling and logging for the auto-launch feature, ensuring that issues during startup are recorded without interrupting operations. - Adjusted the initialization process to manage unused results, reducing unnecessary warnings and promoting a smoother, more robust experience. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 6e57869 commit a3db647

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src-tauri/src/auto_launcher.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ impl AutoLauncher {
115115
auto_launcher.enable()?;
116116
// To startup application as admin on windows, we need to create a task scheduler
117117
#[cfg(target_os = "windows")]
118-
self.toggle_windows_admin_auto_launcher(true).await?;
118+
let _unused = self.toggle_windows_admin_auto_launcher(true).await.inspect_err(|e| {
119+
warn!(target: LOG_TARGET, "Failed to enable admin auto-launcher: {}", e)
120+
});
119121
}
120122
_ => {
121123
auto_launcher.enable()?;
@@ -126,7 +128,9 @@ impl AutoLauncher {
126128
match PlatformUtils::detect_current_os() {
127129
CurrentOperatingSystem::Windows => {
128130
#[cfg(target_os = "windows")]
129-
self.toggle_windows_admin_auto_launcher(false).await?;
131+
let _unused = self.toggle_windows_admin_auto_launcher(false).await.inspect_err(|e| {
132+
warn!(target: LOG_TARGET, "Failed to disable admin auto-launcher: {}", e)
133+
});
130134
auto_launcher.disable()?;
131135
}
132136
_ => {

src-tauri/src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,10 @@ async fn setup_inner(
380380
let mm_proxy_manager = state.mm_proxy_manager.clone();
381381

382382
let is_auto_launcher_enabled = state.config.read().await.should_auto_launch();
383-
AutoLauncher::current()
383+
let _unused = AutoLauncher::current()
384384
.initialize_auto_launcher(is_auto_launcher_enabled)
385-
.await?;
385+
.await
386+
.inspect_err(|e| error!(target: LOG_TARGET, "Could not initialize auto launcher: {:?}", e));
386387

387388
let (tx, rx) = watch::channel("".to_string());
388389
let progress = ProgressTracker::new(app.clone(), Some(tx));

0 commit comments

Comments
 (0)