Skip to content

Commit 7bd3705

Browse files
committed
tests: await after abort
1 parent 48dfe66 commit 7bd3705

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/main.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,13 @@ async fn main() -> anyhow::Result<()> {
196196
});
197197

198198
// Set up terminal
199-
crossterm::terminal::enable_raw_mode()?;
200199
let _terminal_cleanup_guard = TerminalCleanupGuard;
201200
crossterm::execute!(
202201
io::stdout(),
203202
crossterm::terminal::EnterAlternateScreen,
204203
crossterm::cursor::Hide,
205204
)?;
205+
crossterm::terminal::enable_raw_mode()?;
206206

207207
// Spawn the completion loader task, which will asynchronously load suggestions based on the input data.
208208
let (shared_suggestions, completion_loader_task) = completion::spawn_initialize(
@@ -408,6 +408,18 @@ async fn main() -> anyhow::Result<()> {
408408
completion_navigator_task.abort();
409409
json_viewer_task.abort();
410410

411+
// Ensure all aborted tasks are fully stopped before terminal cleanup runs.
412+
let _ = spinner_task.await;
413+
let _ = query_debouncer.await;
414+
let _ = resize_debouncer.await;
415+
let _ = completion_loader_task.await;
416+
let _ = query_change_forward_task.await;
417+
let _ = resize_render_task.await;
418+
let _ = guide_task.await;
419+
let _ = query_editor_task.await;
420+
let _ = completion_navigator_task.await;
421+
let _ = json_viewer_task.await;
422+
411423
// Restore terminal state and write output to stdout if the option is enabled.
412424
stdout_redirect.restore()?;
413425

0 commit comments

Comments
 (0)