1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-26 17:02:20 -05:00
denoland-deno/cli/tokio_util.rs

16 lines
378 B
Rust
Raw Normal View History

2020-01-02 15:13:47 -05:00
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
2020-01-30 11:28:51 -05:00
#[cfg(test)]
pub fn run<F>(future: F)
where
2020-01-30 11:28:51 -05:00
F: std::future::Future<Output = ()> + Send + 'static,
{
2020-01-30 11:28:51 -05:00
let mut rt = tokio::runtime::Builder::new()
2019-12-30 14:57:17 +01:00
.threaded_scheduler()
.enable_all()
.thread_name("deno")
.build()
.expect("Unable to create Tokio runtime");
rt.block_on(future);
}