fix blocking for #1381 (#1438)

This commit is contained in:
Conrad Ludgate 2023-12-11 18:06:14 +00:00 committed by GitHub
parent 04903bf526
commit 9ca8f10bf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,8 +52,20 @@ pub enum Cmd {
} }
impl Cmd { impl Cmd {
#[tokio::main(flavor = "current_thread")] pub fn run(self) -> Result<()> {
pub async fn run(self) -> Result<()> { let runtime = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap();
let res = runtime.block_on(self.run_inner());
runtime.shutdown_timeout(std::time::Duration::from_millis(50));
res
}
async fn run_inner(self) -> Result<()> {
Builder::new() Builder::new()
.filter_level(log::LevelFilter::Off) .filter_level(log::LevelFilter::Off)
.parse_env("ATUIN_LOG") .parse_env("ATUIN_LOG")