gpui: Don't panic when failing to exec system opener (#21674)

This commit is contained in:
Cole Miller
2024-12-06 22:11:40 -05:00
committed by GitHub
parent 4d22a07a1e
commit fa7dddd6b5
2 changed files with 10 additions and 8 deletions
+4 -4
View File
@@ -18,7 +18,7 @@ use std::{
time::Duration,
};
use anyhow::anyhow;
use anyhow::{anyhow, Context as _};
use async_task::Runnable;
use calloop::channel::Channel;
use calloop::{EventLoop, LoopHandle, LoopSignal};
@@ -382,14 +382,14 @@ impl<P: LinuxClient + 'static> Platform for P {
}
fn open_with_system(&self, path: &Path) {
let executor = self.background_executor().clone();
let path = path.to_owned();
executor
self.background_executor()
.spawn(async move {
let _ = std::process::Command::new("xdg-open")
.arg(path)
.spawn()
.expect("Failed to open file with xdg-open");
.context("invoking xdg-open")
.log_err();
})
.detach();
}