From fdf32feb33de8496a585dd743d69bc7ed397c4c9 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sat, 7 Nov 2026 15:28:55 +0100 Subject: refactor(yt): Manual print the returned error from the cmds --- crates/yt/src/main.rs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'crates') diff --git a/crates/yt/src/main.rs b/crates/yt/src/main.rs index 8c67e95..fd7c23b 100644 --- a/crates/yt/src/main.rs +++ b/crates/yt/src/main.rs @@ -13,8 +13,9 @@ // to print it anyways. #![allow(clippy::missing_errors_doc, clippy::missing_panics_doc)] -use anyhow::{Context, Result}; -use app::App; +use std::process; + +use anyhow::Result; use clap::{CommandFactory, Parser}; use log::info; @@ -107,10 +108,20 @@ async fn main() -> Result<()> { let app = App::new(config, !args.no_migrate_db).await?; - args.command - .unwrap_or(Command::default()) - .implm(app) - .await?; + let result = args.command.unwrap_or(Command::default()).implm(app).await; + + // TODO(@bpeetz): I don't know why, but just bubbling the error up with `?` will result in an + // infinite hang? + // So we manually print and exit, upon receiving an error. + // <2026-08-18> + if let Err(err) = result { + // Print one newline, so that we are sure, we are not printing the error _inside_ of a + // started progress bar line. + eprintln!(); + + eprintln!("{err:?}"); + process::exit(1); + } Ok(()) } -- cgit v1.3.1