use std::process::Output;
pub(crate) type DealerResult<T> = Result<T, DealerError>;
#[derive(Debug, thiserror::Error)]
pub(crate) enum DealerError {
PackageResolution(String),
#[error("I/O error at '{}': {source}", path.display())]
Io { path: PathBuf, source: io::Error },
pub(crate) fn io(path: impl Into<PathBuf>, source: io::Error) -> Self {
pub(crate) fn process_output_message(output: Output, label: &str) -> String {
let stdout = String::from_utf8_lossy(&output.stdout);
let stderr = String::from_utf8_lossy(&output.stderr);
let mut message = String::new();
if !stdout.trim().is_empty() {
message.push_str(&stdout);
if !stderr.trim().is_empty() {
message.push_str(&stderr);
message.push_str(&format!("{label} exited with status {}", output.status));