1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-09-15 19:26:58 +02:00

fix: regression caused by #1089

This resolves an issue caused by a previous fix which broke launching applications with the `launcher` and `menu` modules
This commit is contained in:
Jake Stanger 2025-07-20 16:21:31 +01:00
commit feccc29fd1
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
2 changed files with 20 additions and 10 deletions

View file

@ -332,7 +332,7 @@ pub async fn open_program(file_name: &str, launch_command: &str) {
let launch_command_parts: Vec<&str> = expanded.split_whitespace().collect(); let launch_command_parts: Vec<&str> = expanded.split_whitespace().collect();
debug!("running {launch_command_parts:?}"); debug!("running {launch_command_parts:?}");
if let Err(err) = Command::new(launch_command_parts[0]) let exit_status = match Command::new(launch_command_parts[0])
.args(&launch_command_parts[1..]) .args(&launch_command_parts[1..])
.stdin(Stdio::null()) .stdin(Stdio::null())
.stdout(Stdio::null()) .stdout(Stdio::null())
@ -340,12 +340,24 @@ pub async fn open_program(file_name: &str, launch_command: &str) {
.kill_on_drop(true) .kill_on_drop(true)
.spawn() .spawn()
{ {
Ok(mut child) => Some(child.wait().await),
Err(err) => {
error!( error!(
"{:?}", "{:?}",
Report::new(err) Report::new(err)
.wrap_err("Failed to run launch command.") .wrap_err("Failed to run launch command.")
.suggestion("Perhaps the desktop file is invalid or orphaned?") .suggestion("Perhaps the desktop file is invalid or orphaned?")
); );
None
}
};
match exit_status {
Some(Ok(exit_status)) if !exit_status.success() => {
error!("received non-success exit status running {launch_command_parts:?}")
}
Some(Err(err)) => error!("{err:?}"),
_ => {}
} }
} }

View file

@ -104,9 +104,7 @@ where
let file_name = file_name.clone(); let file_name = file_name.clone();
let command = command.clone(); let command = command.clone();
glib::spawn_future_local(async move { spawn(async move { open_program(&file_name, &command).await });
open_program(&file_name, &command).await
});
sub_menu.hide(); sub_menu.hide();
tx.send_spawn(ModuleUpdateEvent::ClosePopup); tx.send_spawn(ModuleUpdateEvent::ClosePopup);