diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2019-01-17 23:39:06 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-17 23:39:06 -0500 |
commit | 315e4abd7e88c428e78c006ccf2dfdb499911a05 (patch) | |
tree | b48136d6f0437374c5c0a9a8f717f7495b5ff808 /src/ops.rs | |
parent | d06c95637a2a19588fcb549ed7b760a916b3cbfd (diff) |
mkdir should not be recursive by default (#1530)
It should return an error if a file with the given path exists and
recursive isn't specified.
Because mode is not used on windows and rarely used in unix, it is made
to the last parameter.
In collaboration with Stefan Dombrowski <sdo451@gmail.com>
Diffstat (limited to 'src/ops.rs')
-rw-r--r-- | src/ops.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ops.rs b/src/ops.rs index abc7b8d34..f3c80e1ac 100644 --- a/src/ops.rs +++ b/src/ops.rs @@ -540,15 +540,17 @@ fn op_mkdir( ) -> Box<Op> { assert_eq!(data.len(), 0); let inner = base.inner_as_mkdir().unwrap(); - let mode = inner.mode(); let path = String::from(inner.path().unwrap()); + let recursive = inner.recursive(); + let mode = inner.mode(); if let Err(e) = state.check_write(&path) { return odd_future(e); } + blocking(base.sync(), move || { debug!("op_mkdir {}", path); - deno_fs::mkdir(Path::new(&path), mode)?; + deno_fs::mkdir(Path::new(&path), mode, recursive)?; Ok(empty_buf()) }) } |