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.

Backport-PR-URL: nodejs#34591
PR-URL: nodejs#32711
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and MylesBorins committed Aug 18, 2020
1 parent b7fb94d commit bb0cc00
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
4 changes: 2 additions & 2 deletions doc/api/deprecations.md
Expand Up @@ -2547,15 +2547,15 @@ To maintain existing behaviour `response.finished` should be replaced with
<!-- YAML
changes:
- version:
- v14.0.0
- REPLACEME
- v14.0.0
pr-url: https://github.com/nodejs/node/pull/32499
description: Documentation-only deprecation.
-->

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
27 changes: 17 additions & 10 deletions doc/api/process.md
Expand Up @@ -2393,27 +2393,35 @@ 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:
- version:
- v14.0.0
- REPLACEME
- v14.0.0
pr-url: https://github.com/nodejs/node/pull/32499
description: Calling `process.umask()` with no arguments is deprecated.
-->

> 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 @@ -2423,8 +2431,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 bb0cc00

Please sign in to comment.