diff --git a/rote/Cargo.toml b/rote/Cargo.toml index 83abb4e..a97ec43 100644 --- a/rote/Cargo.toml +++ b/rote/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rote-mux" -version = "0.1.2" +version = "0.1.3" edition = "2024" description = "A terminal multiplexer for monitoring and managing multiple processes" license = "MIT" diff --git a/rote/src/bin/rote.rs b/rote/src/bin/rote.rs index 11299db..c78483d 100644 --- a/rote/src/bin/rote.rs +++ b/rote/src/bin/rote.rs @@ -25,7 +25,17 @@ struct Args { } #[tokio::main] -async fn main() -> anyhow::Result<()> { +async fn main() { + if let Err(e) = run().await { + eprintln!("error: {e}"); + for cause in e.chain().skip(1) { + eprintln!(" caused by: {cause}"); + } + std::process::exit(1); + } +} + +async fn run() -> anyhow::Result<()> { let args = Args::parse(); if args.generate_example { @@ -41,12 +51,14 @@ async fn main() -> anyhow::Result<()> { let yaml_dir = config_path .parent() - .ok_or_else(|| anyhow::anyhow!("Failed to determine config file directory"))? + .ok_or_else(|| anyhow::anyhow!("failed to determine config file directory"))? .to_path_buf(); - let yaml_str = fs::read_to_string(&config_path).context("Reading the config file")?; + let yaml_str = fs::read_to_string(&config_path) + .with_context(|| format!("failed to read config file '{}'", config_path.display()))?; - let config: Config = serde_yaml::from_str(&yaml_str).context("Parsing the config file")?; + let config: Config = + serde_yaml::from_str(&yaml_str).context("failed to parse config file as YAML")?; rote_mux::run(config, args.services, yaml_dir).await?;