summaryrefslogtreecommitdiff
path: root/cli/tools/bench.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tools/bench.rs')
-rw-r--r--cli/tools/bench.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/cli/tools/bench.rs b/cli/tools/bench.rs
index 18ac63f38..419ac2da6 100644
--- a/cli/tools/bench.rs
+++ b/cli/tools/bench.rs
@@ -30,6 +30,7 @@ use indexmap::IndexMap;
use log::Level;
use serde::Deserialize;
use serde::Serialize;
+use std::cell::RefCell;
use std::collections::HashSet;
use std::path::Path;
use std::path::PathBuf;
@@ -337,7 +338,6 @@ async fn check_specifiers(
lib,
PermissionsContainer::allow_all(),
PermissionsContainer::new(permissions),
- true,
)
.await?;
@@ -529,12 +529,14 @@ pub async fn run_benchmarks_with_watch(
Permissions::from_options(&ps.options.permissions_options())?;
let no_check = ps.options.type_check_mode() == TypeCheckMode::None;
+ let ps = RefCell::new(ps);
+
let resolver = |changed: Option<Vec<PathBuf>>| {
let paths_to_watch = bench_options.files.include.clone();
let paths_to_watch_clone = paths_to_watch.clone();
let files_changed = changed.is_some();
let bench_options = &bench_options;
- let ps = ps.clone();
+ let ps = ps.borrow().clone();
async move {
let bench_modules =
@@ -638,7 +640,8 @@ pub async fn run_benchmarks_with_watch(
let operation = |modules_to_reload: Vec<ModuleSpecifier>| {
let permissions = &permissions;
let bench_options = &bench_options;
- let ps = ps.clone();
+ ps.borrow_mut().reset_for_file_watcher();
+ let ps = ps.borrow().clone();
async move {
let specifiers =
@@ -663,12 +666,13 @@ pub async fn run_benchmarks_with_watch(
}
};
+ let clear_screen = !ps.borrow().options.no_clear_screen();
file_watcher::watch_func(
resolver,
operation,
file_watcher::PrintConfig {
job_name: "Bench".to_string(),
- clear_screen: !ps.options.no_clear_screen(),
+ clear_screen,
},
)
.await?;