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 2025-08-13 00:37:11 +02:00 committed by GitHub
parent 13a2c53381
commit 658d56bd72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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 {}",