fix crash with error in startup script

macos-click-through
Keith Simmons 5 years ago
parent 54212f73f5
commit e0acbd0b9f

@ -88,6 +88,7 @@ async fn start_nvim(editor: Arc<Mutex<Editor>>, mut receiver: UnboundedReceiver<
nvim.ui_attach(INITIAL_WIDTH as i64, INITIAL_HEIGHT as i64, &options).await nvim.ui_attach(INITIAL_WIDTH as i64, INITIAL_HEIGHT as i64, &options).await
.unwrap_or_explained_panic("Could not attach.", "Could not attach ui to neovim process"); .unwrap_or_explained_panic("Could not attach.", "Could not attach ui to neovim process");
let nvim = Arc::new(nvim);
loop { loop {
let mut commands = Vec::new(); let mut commands = Vec::new();
let mut resize_command = None; let mut resize_command = None;
@ -102,9 +103,12 @@ async fn start_nvim(editor: Arc<Mutex<Editor>>, mut receiver: UnboundedReceiver<
commands.push(resize_command); commands.push(resize_command);
} }
for ui_command in commands.iter() { let nvim = nvim.clone();
tokio::spawn(async move {
for ui_command in commands.into_iter() {
ui_command.execute(&nvim).await; ui_command.execute(&nvim).await;
} }
});
} }
} }

Loading…
Cancel
Save