diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-01-07 17:25:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-07 17:25:34 +0100 |
commit | fac64478157ee563b185edb5734688e4523df3a1 (patch) | |
tree | 888d562982e1fc37dfb9a4459928bcec84d55dfc /cli/graph_util.rs | |
parent | 82e930726ee5dbac8e6eae0962c07c72daf9843c (diff) |
refactor(permissions): add PermissionsContainer struct for internal mutability (#17134)
Turns out we were cloning permissions which after prompting were discarded,
so the state of permissions was never preserved. To handle that we need to store
all permissions behind "Arc<Mutex<>>" (because there are situations where we
need to send them to other thread).
Testing and benching code still uses "Permissions" in most places - it's undesirable
to share the same permission set between various test/bench files - otherwise
granting or revoking permissions in one file would influence behavior of other test
files.
Diffstat (limited to 'cli/graph_util.rs')
-rw-r--r-- | cli/graph_util.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cli/graph_util.rs b/cli/graph_util.rs index d815e3311..812701892 100644 --- a/cli/graph_util.rs +++ b/cli/graph_util.rs @@ -28,7 +28,7 @@ use deno_graph::ModuleGraphError; use deno_graph::ModuleKind; use deno_graph::Range; use deno_graph::Resolved; -use deno_runtime::permissions::Permissions; +use deno_runtime::permissions::PermissionsContainer; use std::collections::BTreeMap; use std::collections::HashMap; use std::collections::HashSet; @@ -514,8 +514,8 @@ pub async fn create_graph_and_maybe_check( let mut cache = cache::FetchCacher::new( ps.emit_cache.clone(), ps.file_fetcher.clone(), - Permissions::allow_all(), - Permissions::allow_all(), + PermissionsContainer::allow_all(), + PermissionsContainer::allow_all(), ); let maybe_imports = ps.options.to_maybe_imports()?; let maybe_cli_resolver = CliResolver::maybe_new( |