cli: Do not rely on Spotlight for --channel support (#36082)

I've recently disabled Spotlight on my Mac and found that this code path
(which I rely on a lot) ceased working for me.

Closes #ISSUE

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz authored and GitHub committed 2025-08-12 22:37:11 +00:00
1 parent 0741d08c4e
commit f862bc73a3
1 file changed
+6 -9
+6 -9
View File
@@ -957,17 +957,14 @@ mod mac_os {
) -> Result<()> {
use anyhow::bail;
let app_id_prompt = format!("id of app \"{}\"", channel.display_name());
let app_id_output = Command::new("osascript")
let app_path_prompt = format!(
"POSIX path of (path to application \"{}\")",
channel.display_name()
);
let app_path_output = Command::new("osascript")
.arg("-e")
.arg(&app_id_prompt)
.arg(&app_path_prompt)
.output()?;
if !app_id_output.status.success() {
bail!("Could not determine app id for {}", channel.display_name());
}
let app_name = String::from_utf8(app_id_output.stdout)?.trim().to_owned();
let app_path_prompt = format!("kMDItemCFBundleIdentifier == '{app_name}'");
let app_path_output = Command::new("mdfind").arg(app_path_prompt).output()?;
if !app_path_output.status.success() {
bail!(
"Could not determine app path for {}",