diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-11-07 15:28:55 +0100 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-11-07 15:28:55 +0100 |
| commit | fdf32feb33de8496a585dd743d69bc7ed397c4c9 (patch) | |
| tree | 0d0f6ad1cc5b017d81dd52b95cec74f3b8367f7a /crates | |
| parent | feat(yt/cmds/download): Support specifying a maximum count to download (diff) | |
| download | yt-fdf32feb33de8496a585dd743d69bc7ed397c4c9.zip | |
refactor(yt): Manual print the returned error from the cmds
Diffstat (limited to '')
| -rw-r--r-- | crates/yt/src/main.rs | 23 |
1 files changed, 17 insertions, 6 deletions
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(()) } |
