diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2019-10-29 01:42:44 +0100 |
---|---|---|
committer | Ry Dahl <ry@tinyclouds.org> | 2019-10-28 20:42:44 -0400 |
commit | a7992e77037353ee4c7d3d480dcbd907961087bd (patch) | |
tree | 3d2750c76c29f69742c39c62f3fb2bc1fc0a1734 /cli/ops/files.rs | |
parent | 2f0f236d5656fa2d89a8e1571d03c4bda5f10d38 (diff) |
refactor: use core ResourceTable in cli (#3206)
Diffstat (limited to 'cli/ops/files.rs')
-rw-r--r-- | cli/ops/files.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cli/ops/files.rs b/cli/ops/files.rs index 0432acd82..c1e43ff95 100644 --- a/cli/ops/files.rs +++ b/cli/ops/files.rs @@ -1,5 +1,6 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. use super::dispatch_json::{Deserialize, JsonOp, Value}; +use crate::deno_error::bad_resource; use crate::fs as deno_fs; use crate::ops::json_op; use crate::resources; @@ -110,8 +111,8 @@ fn op_close( ) -> Result<JsonOp, ErrBox> { let args: CloseArgs = serde_json::from_value(args)?; - let resource = resources::lookup(args.rid as u32)?; - resource.close(); + let mut table = resources::lock_resource_table(); + table.close(args.rid as u32).ok_or_else(bad_resource)?; Ok(JsonOp::Sync(json!({}))) } |