From 335bfe91d7efdfd5a89eaf7728511f96dab3fef3 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sat, 22 Feb 2025 11:33:19 +0100 Subject: fix(yt/): Box large futures Otherwise, they could result in a stack overflow --- yt/src/main.rs | 6 +++--- yt/src/select/cmds/mod.rs | 4 +++- yt/src/select/mod.rs | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/yt/src/main.rs b/yt/src/main.rs index ba87f3f..b32b1d3 100644 --- a/yt/src/main.rs +++ b/yt/src/main.rs @@ -114,12 +114,12 @@ async fn main() -> Result<()> { SelectCommand::File { done, use_last_selection, - } => select::select(&app, done, use_last_selection).await?, - _ => handle_select_cmd(&app, cmd, None).await?, + } => Box::pin(select::select(&app, done, use_last_selection)).await?, + _ => Box::pin(handle_select_cmd(&app, cmd, None)).await?, } } Command::Sedowa {} => { - select::select(&app, false, false).await?; + Box::pin(select::select(&app, false, false)).await?; let arc_app = Arc::new(app); dowa(arc_app).await?; diff --git a/yt/src/select/cmds/mod.rs b/yt/src/select/cmds/mod.rs index e7f8594..66dfa4c 100644 --- a/yt/src/select/cmds/mod.rs +++ b/yt/src/select/cmds/mod.rs @@ -37,7 +37,9 @@ pub async fn handle_select_cmd( SelectCommand::Watched { shared } => { handle_status_change(app, shared, line_number, VideoStatus::Watched).await?; } - SelectCommand::Add { urls, start, stop } => add::add(app, urls, start, stop).await?, + SelectCommand::Add { urls, start, stop } => { + Box::pin(add::add(app, urls, start, stop)).await?; + } SelectCommand::Watch { shared } => { let hash = shared.hash.clone().realize(app).await?; diff --git a/yt/src/select/mod.rs b/yt/src/select/mod.rs index 44c8d4f..4c34d16 100644 --- a/yt/src/select/mod.rs +++ b/yt/src/select/mod.rs @@ -133,14 +133,14 @@ pub async fn select(app: &App, done: bool, use_last_selection: bool) -> Result<( unreachable!("This is checked in the `filter_line` function") }; - handle_select_cmd( + Box::pin(handle_select_cmd( app, cmd.unreachable( "This value should always be some \ here, as it would otherwise thrown an error above.", ), Some(line_number), - ) + )) .await?; } } -- cgit 1.4.1