refactor(deep-link)!: return Error::Execute when an OS command fails to run (#3603)

* refactor(deep-link)!: return Error::Execute when an OS command fails to run

On Linux, `register`, `unregister` and `is_registered` now fail with the
new `Error::Execute(command, io_error)` variant when `xdg-mime` or
`update-desktop-database` cannot be spawned, instead of logging and
returning the raw `Error::Io`. This is the change deferred to v3 in #2970.

* docs(deep-link): unregister does not run OS commands
This commit is contained in:
Lucas Fernandes Nogueira
2026-09-22 06:04:13 -03:00
committed by GitHub
parent c7416a1a2c
commit 120d00558e
3 changed files with 12 additions and 15 deletions
+3 -5
View File
@@ -351,14 +351,12 @@ mod imp {
Command::new("update-desktop-database")
.arg(target)
.status()
.inspect_err(crate::error::inspect_command_error(
"update-desktop-database",
))?;
.map_err(|error| crate::Error::Execute("update-desktop-database", error))?;
Command::new("xdg-mime")
.args(["default", &file_name, mime_type.as_str()])
.status()
.inspect_err(crate::error::inspect_command_error("xdg-mime"))?;
.map_err(|error| crate::Error::Execute("xdg-mime", error))?;
Ok(())
}
@@ -463,7 +461,7 @@ mod imp {
&format!("x-scheme-handler/{}", _protocol.as_ref()),
])
.output()
.inspect_err(crate::error::inspect_command_error("xdg-mime"))?;
.map_err(|error| crate::Error::Execute("xdg-mime", error))?;
Ok(String::from_utf8_lossy(&output.stdout).contains(&file_name))
}