forked from denoland/deno
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6443e4a
commit 8078d97
Showing
7 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. | ||
import { sendSync } from "../dispatch_json.ts"; | ||
|
||
/** | ||
* **UNSTABLE**: maybe needs `allow-env` permissions. | ||
* | ||
* If `mask` is provided, sets the process umask. Always returns what the umask | ||
* was before the call. | ||
*/ | ||
export function umask(mask?: number): number { | ||
return sendSync("op_umask", { mask }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. | ||
import { unitTest, assertEquals } from "./test_util.ts"; | ||
|
||
unitTest( | ||
{ | ||
skip: Deno.build.os === "win" | ||
}, | ||
function umaskSuccess(): void { | ||
const prevMask = Deno.umask(0o020); | ||
const newMask = Deno.umask(prevMask); | ||
const finalMask = Deno.umask(); | ||
assertEquals(newMask, 0o020); | ||
assertEquals(finalMask, prevMask); | ||
assertEquals(prevMask, 0o022); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters