summaryrefslogtreecommitdiff
path: root/cli/ops/fs.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/ops/fs.rs')
-rw-r--r--cli/ops/fs.rs59
1 files changed, 17 insertions, 42 deletions
diff --git a/cli/ops/fs.rs b/cli/ops/fs.rs
index 7610231c7..c5d1458fc 100644
--- a/cli/ops/fs.rs
+++ b/cli/ops/fs.rs
@@ -282,10 +282,7 @@ fn op_fdatasync_sync(
args: Value,
_zero_copy: &mut [ZeroCopyBuf],
) -> Result<Value, AnyError> {
- {
- let cli_state = super::global_state(state);
- cli_state.check_unstable("Deno.fdatasync");
- }
+ super::check_unstable(state, "Deno.fdatasync");
let args: FdatasyncArgs = serde_json::from_value(args)?;
let rid = args.rid as u32;
std_file_resource(state, rid, |r| match r {
@@ -300,7 +297,7 @@ async fn op_fdatasync_async(
args: Value,
_zero_copy: BufVec,
) -> Result<Value, AnyError> {
- super::global_state2(&state).check_unstable("Deno.fdatasync");
+ super::check_unstable2(&state, "Deno.fdatasync");
let args: FdatasyncArgs = serde_json::from_value(args)?;
let rid = args.rid as u32;
@@ -322,10 +319,7 @@ fn op_fsync_sync(
args: Value,
_zero_copy: &mut [ZeroCopyBuf],
) -> Result<Value, AnyError> {
- {
- let cli_state = super::global_state(state);
- cli_state.check_unstable("Deno.fsync");
- }
+ super::check_unstable(state, "Deno.fsync");
let args: FsyncArgs = serde_json::from_value(args)?;
let rid = args.rid as u32;
std_file_resource(state, rid, |r| match r {
@@ -340,7 +334,7 @@ async fn op_fsync_async(
args: Value,
_zero_copy: BufVec,
) -> Result<Value, AnyError> {
- super::global_state2(&state).check_unstable("Deno.fsync");
+ super::check_unstable2(&state, "Deno.fsync");
let args: FsyncArgs = serde_json::from_value(args)?;
let rid = args.rid as u32;
@@ -362,10 +356,7 @@ fn op_fstat_sync(
args: Value,
_zero_copy: &mut [ZeroCopyBuf],
) -> Result<Value, AnyError> {
- {
- let cli_state = super::global_state(state);
- cli_state.check_unstable("Deno.fstat");
- }
+ super::check_unstable(state, "Deno.fstat");
let args: FstatArgs = serde_json::from_value(args)?;
let rid = args.rid as u32;
let metadata = std_file_resource(state, rid, |r| match r {
@@ -380,7 +371,7 @@ async fn op_fstat_async(
args: Value,
_zero_copy: BufVec,
) -> Result<Value, AnyError> {
- super::global_state2(&state).check_unstable("Deno.fstat");
+ super::check_unstable2(&state, "Deno.fstat");
let args: FstatArgs = serde_json::from_value(args)?;
let rid = args.rid as u32;
@@ -404,10 +395,7 @@ fn op_umask(
args: Value,
_zero_copy: &mut [ZeroCopyBuf],
) -> Result<Value, AnyError> {
- {
- let cli_state = super::global_state(state);
- cli_state.check_unstable("Deno.umask");
- }
+ super::check_unstable(state, "Deno.umask");
let args: UmaskArgs = serde_json::from_value(args)?;
// TODO implement umask for Windows
// see https://github.com/nodejs/node/blob/master/src/node_process_methods.cc
@@ -1134,8 +1122,7 @@ fn op_link_sync(
args: Value,
_zero_copy: &mut [ZeroCopyBuf],
) -> Result<Value, AnyError> {
- let cli_state = super::global_state(state);
- cli_state.check_unstable("Deno.link");
+ super::check_unstable(state, "Deno.link");
let args: LinkArgs = serde_json::from_value(args)?;
let oldpath = PathBuf::from(&args.oldpath);
let newpath = PathBuf::from(&args.newpath);
@@ -1154,8 +1141,7 @@ async fn op_link_async(
args: Value,
_zero_copy: BufVec,
) -> Result<Value, AnyError> {
- let cli_state = super::global_state2(&state);
- cli_state.check_unstable("Deno.link");
+ super::check_unstable2(&state, "Deno.link");
let args: LinkArgs = serde_json::from_value(args)?;
let oldpath = PathBuf::from(&args.oldpath);
@@ -1198,8 +1184,7 @@ fn op_symlink_sync(
args: Value,
_zero_copy: &mut [ZeroCopyBuf],
) -> Result<Value, AnyError> {
- let cli_state = super::global_state(state);
- cli_state.check_unstable("Deno.symlink");
+ super::check_unstable(state, "Deno.symlink");
let args: SymlinkArgs = serde_json::from_value(args)?;
let oldpath = PathBuf::from(&args.oldpath);
let newpath = PathBuf::from(&args.newpath);
@@ -1250,8 +1235,7 @@ async fn op_symlink_async(
args: Value,
_zero_copy: BufVec,
) -> Result<Value, AnyError> {
- let cli_state = super::global_state2(&state);
- cli_state.check_unstable("Deno.symlink");
+ super::check_unstable2(&state, "Deno.symlink");
let args: SymlinkArgs = serde_json::from_value(args)?;
let oldpath = PathBuf::from(&args.oldpath);
@@ -1356,10 +1340,7 @@ fn op_ftruncate_sync(
args: Value,
_zero_copy: &mut [ZeroCopyBuf],
) -> Result<Value, AnyError> {
- {
- let cli_state = super::global_state(state);
- cli_state.check_unstable("Deno.ftruncate");
- }
+ super::check_unstable(state, "Deno.ftruncate");
let args: FtruncateArgs = serde_json::from_value(args)?;
let rid = args.rid as u32;
let len = args.len as u64;
@@ -1375,7 +1356,7 @@ async fn op_ftruncate_async(
args: Value,
_zero_copy: BufVec,
) -> Result<Value, AnyError> {
- super::global_state2(&state).check_unstable("Deno.ftruncate");
+ super::check_unstable2(&state, "Deno.ftruncate");
let args: FtruncateArgs = serde_json::from_value(args)?;
let rid = args.rid as u32;
let len = args.len as u64;
@@ -1628,10 +1609,7 @@ fn op_futime_sync(
args: Value,
_zero_copy: &mut [ZeroCopyBuf],
) -> Result<Value, AnyError> {
- {
- let cli_state = super::global_state(state);
- cli_state.check_unstable("Deno.futimeSync");
- }
+ super::check_unstable(state, "Deno.futimeSync");
let args: FutimeArgs = serde_json::from_value(args)?;
let rid = args.rid as u32;
let atime = filetime::FileTime::from_unix_time(args.atime.0, args.atime.1);
@@ -1656,8 +1634,7 @@ async fn op_futime_async(
_zero_copy: BufVec,
) -> Result<Value, AnyError> {
let mut state = state.borrow_mut();
- let cli_state = super::global_state(&state);
- cli_state.check_unstable("Deno.futime");
+ super::check_unstable(&state, "Deno.futime");
let args: FutimeArgs = serde_json::from_value(args)?;
let rid = args.rid as u32;
let atime = filetime::FileTime::from_unix_time(args.atime.0, args.atime.1);
@@ -1689,8 +1666,7 @@ fn op_utime_sync(
args: Value,
_zero_copy: &mut [ZeroCopyBuf],
) -> Result<Value, AnyError> {
- let cli_state = super::global_state(state);
- cli_state.check_unstable("Deno.utime");
+ super::check_unstable(state, "Deno.utime");
let args: UtimeArgs = serde_json::from_value(args)?;
let path = PathBuf::from(&args.path);
@@ -1708,8 +1684,7 @@ async fn op_utime_async(
_zero_copy: BufVec,
) -> Result<Value, AnyError> {
let state = state.borrow();
- let cli_state = super::global_state(&state);
- cli_state.check_unstable("Deno.utime");
+ super::check_unstable(&state, "Deno.utime");
let args: UtimeArgs = serde_json::from_value(args)?;
let path = PathBuf::from(&args.path);