summaryrefslogtreecommitdiff
path: root/cli/tokio_util.rs
blob: df14d11e4b754ff0d8c8ff8328cbf2e526f6a0c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
use std::future::Future;
use tokio;
use tokio::runtime;

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