Skip to content

Commit

Permalink
doc: split process.umask() entry into two
Browse files Browse the repository at this point in the history
Split doc entries for process.umask() into one entry for process.umask()
(which is deprecated) and another for `process.umask(mask)` which is
not deprecated.

PR-URL: #32711
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and BethGriggs committed Apr 14, 2020
1 parent b68e26e commit 1db8da2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2646,7 +2646,7 @@ changes:
Type: Documentation-only
Calling `process.umask()` with no arguments causes the process-wide umask to be
Calling `process.umask()` with no argument causes the process-wide umask to be
written twice. This introduces a race condition between threads, and is a
potential security vulnerability. There is no safe, cross-platform alternative
API.
Expand Down
25 changes: 16 additions & 9 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -2423,7 +2423,7 @@ documentation for the [`'warning'` event][process_warning] and the
[`emitWarning()` method][process_emit_warning] for more information about this
flag's behavior.

## `process.umask([mask])`
## `process.umask()`
<!-- YAML
added: v0.1.19
changes:
Expand All @@ -2433,15 +2433,23 @@ changes:
-->

> Stability: 0 - Deprecated. Calling `process.umask()` with no arguments is
> deprecated. No alternative is provided.
> Stability: 0 - Deprecated. Calling `process.umask()` with no argument causes
> the process-wide umask to be written twice. This introduces a race condition
> between threads, and is a potential security vulnerability. There is no safe,
> cross-platform alternative API.
`process.umask()` returns the Node.js process's file mode creation mask. Child
processes inherit the mask from the parent process.

## `process.umask(mask)`
<!-- YAML
added: v0.1.19
-->

* `mask` {string|integer}

The `process.umask()` method sets or returns the Node.js process's file mode
creation mask. Child processes inherit the mask from the parent process. Invoked
without an argument, the current mask is returned, otherwise the umask is set to
the argument value and the previous mask is returned.
`process.umask(mask)` sets the Node.js process's file mode creation mask. Child
processes inherit the mask from the parent process. Returns the previous mask.

```js
const newmask = 0o022;
Expand All @@ -2451,8 +2459,7 @@ console.log(
);
```

[`Worker`][] threads are able to read the umask, however attempting to set the
umask will result in a thrown exception.
In [`Worker`][] threads, `process.umask(mask)` will throw an exception.

## `process.uptime()`
<!-- YAML
Expand Down

0 comments on commit 1db8da2

Please sign in to comment.