refactor: manualy build tokio runtime for k2v-cli

This commit is contained in:
Gwen Lg
2026-02-03 23:22:11 +01:00
parent ca1211d927
commit 5c8a31708e
+9 -3
View File
@@ -388,8 +388,7 @@ impl Filter {
}
}
#[tokio::main]
async fn main() -> Result<(), Error> {
fn main() -> Result<(), Error> {
if std::env::var("RUST_LOG").is_err() {
std::env::set_var("RUST_LOG", "warn")
}
@@ -412,6 +411,14 @@ async fn main() -> Result<(), Error> {
let client = K2vClient::new(config)?;
tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap()
.block_on(run(args))
}
async fn run(args: Args) -> Result<(), Error> {
match args.command {
Command::Insert {
partition_key,
@@ -603,6 +610,5 @@ async fn main() -> Result<(), Error> {
}
}
}
Ok(())
}