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:
parent
13a2c53381
commit
658d56bd72
1 changed files with 6 additions and 9 deletions
|
@ -957,17 +957,14 @@ mod mac_os {
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
use anyhow::bail;
|
use anyhow::bail;
|
||||||
|
|
||||||
let app_id_prompt = format!("id of app \"{}\"", channel.display_name());
|
let app_path_prompt = format!(
|
||||||
let app_id_output = Command::new("osascript")
|
"POSIX path of (path to application \"{}\")",
|
||||||
|
channel.display_name()
|
||||||
|
);
|
||||||
|
let app_path_output = Command::new("osascript")
|
||||||
.arg("-e")
|
.arg("-e")
|
||||||
.arg(&app_id_prompt)
|
.arg(&app_path_prompt)
|
||||||
.output()?;
|
.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() {
|
if !app_path_output.status.success() {
|
||||||
bail!(
|
bail!(
|
||||||
"Could not determine app path for {}",
|
"Could not determine app path for {}",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue