about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-02-22 11:33:19 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-02-22 11:33:19 +0100
commit335bfe91d7efdfd5a89eaf7728511f96dab3fef3 (patch)
tree89d365b5731999e47aba0f1e40e79c88e9159f1d
parentfix(yt/main): Call `watch` with the required `Arc<App>` (diff)
downloadyt-335bfe91d7efdfd5a89eaf7728511f96dab3fef3.zip
fix(yt/): Box large futures
Otherwise, they could result in a stack overflow
-rw-r--r--yt/src/main.rs6
-rw-r--r--yt/src/select/cmds/mod.rs4
-rw-r--r--yt/src/select/mod.rs4
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?;
         }
     }