summaryrefslogtreecommitdiff
path: root/cli/tokio_util.rs
blob: 3bf82f3143bdeabb2521056d91ec228013d47846 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.

#[cfg(test)]
pub fn run<F>(future: F)
where
  F: std::future::Future<Output = ()> + Send + 'static,
{
  let mut rt = tokio::runtime::Builder::new()
    .threaded_scheduler()
    .enable_all()
    .thread_name("deno")
    .build()
    .expect("Unable to create Tokio runtime");
  rt.block_on(future);
}