diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/mkdir_test.ts | 9 | ||||
-rw-r--r-- | js/stat.ts | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/js/mkdir_test.ts b/js/mkdir_test.ts index ed275bd36..4f82401dc 100644 --- a/js/mkdir_test.ts +++ b/js/mkdir_test.ts @@ -9,6 +9,15 @@ testPerm({ write: true }, function mkdirSyncSuccess() { assert(pathInfo.isDirectory()); }); +testPerm({ write: true }, function mkdirSyncMode() { + const path = deno.makeTempDirSync() + "/dir/subdir"; + deno.mkdirSync(path, 0o755); // no perm for x + const pathInfo = deno.statSync(path); + if (pathInfo.mode !== null) { // Skip windows + assertEqual(pathInfo.mode & 0o777, 0o755); + } +}); + testPerm({ write: false }, function mkdirSyncPerm() { let err; try { diff --git a/js/stat.ts b/js/stat.ts index 3193794a5..434841ec2 100644 --- a/js/stat.ts +++ b/js/stat.ts @@ -51,7 +51,8 @@ export class FileInfo { this.modified = modified ? modified : null; this.accessed = accessed ? accessed : null; this.created = created ? created : null; - this.mode = mode >= 0 ? mode : null; // null if invalid mode (Windows) + // null if invalid mode (Windows) + this.mode = mode >= 0 ? mode & 0o7777 : null; } /** |