Fix panic opening rust file

Application::new will use stuff that requires tokio runtime.
pull/57/head
Ivan Tham 3 years ago
parent 0a6672c626
commit eab6e53511

@ -51,7 +51,8 @@ pub struct Args {
files: Vec<PathBuf>, files: Vec<PathBuf>,
} }
fn main() -> Result<()> { #[tokio::main]
async fn main() -> Result<()> {
let help = format!( let help = format!(
"\ "\
{} {} {} {}
@ -113,13 +114,9 @@ FLAGS:
let config = toml::from_slice(toml).context("Could not parse languages.toml")?; let config = toml::from_slice(toml).context("Could not parse languages.toml")?;
LOADER.get_or_init(|| Loader::new(config)); LOADER.get_or_init(|| Loader::new(config));
let runtime = tokio::runtime::Runtime::new().context("unable to start tokio runtime")?;
// TODO: use the thread local executor to spawn the application task separately from the work pool // TODO: use the thread local executor to spawn the application task separately from the work pool
let mut app = Application::new(args).context("unable to create new appliction")?; let mut app = Application::new(args).context("unable to create new appliction")?;
runtime.block_on(async move { app.run().await;
app.run().await;
});
Ok(()) Ok(())
} }

Loading…
Cancel
Save