1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 05:42:03 +03:00

wezterm cli: replace SimpleExecutor with ScopedExecutor

This is slightly nicer
This commit is contained in:
Wez Furlong 2022-01-07 11:58:04 -07:00
parent e8995c5370
commit 5f77936152

View File

@ -607,18 +607,10 @@ async fn run_cli_async(config: config::ConfigHandle, cli: CliCommand) -> anyhow:
}
fn run_cli(config: config::ConfigHandle, cli: CliCommand) -> anyhow::Result<()> {
let executor = promise::spawn::SimpleExecutor::new();
promise::spawn::spawn(async move {
match run_cli_async(config, cli).await {
Ok(_) => std::process::exit(0),
Err(err) => {
terminate_with_error(err);
}
}
})
.detach();
loop {
executor.tick()?;
let executor = promise::spawn::ScopedExecutor::new();
match promise::spawn::block_on(executor.run(async move { run_cli_async(config, cli).await })) {
Ok(_) => Ok(()),
Err(err) => terminate_with_error(err),
}
}