Skip to content

Commit 1db8da2

Browse files
TrottBethGriggs
authored andcommitted
doc: split process.umask() entry into two
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 <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent b68e26e commit 1db8da2

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

doc/api/deprecations.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2646,7 +2646,7 @@ changes:
26462646
26472647
Type: Documentation-only
26482648
2649-
Calling `process.umask()` with no arguments causes the process-wide umask to be
2649+
Calling `process.umask()` with no argument causes the process-wide umask to be
26502650
written twice. This introduces a race condition between threads, and is a
26512651
potential security vulnerability. There is no safe, cross-platform alternative
26522652
API.

doc/api/process.md

+16-9
Original file line numberDiff line numberDiff line change
@@ -2423,7 +2423,7 @@ documentation for the [`'warning'` event][process_warning] and the
24232423
[`emitWarning()` method][process_emit_warning] for more information about this
24242424
flag's behavior.
24252425

2426-
## `process.umask([mask])`
2426+
## `process.umask()`
24272427
<!-- YAML
24282428
added: v0.1.19
24292429
changes:
@@ -2433,15 +2433,23 @@ changes:
24332433
24342434
-->
24352435

2436-
> Stability: 0 - Deprecated. Calling `process.umask()` with no arguments is
2437-
> deprecated. No alternative is provided.
2436+
> Stability: 0 - Deprecated. Calling `process.umask()` with no argument causes
2437+
> the process-wide umask to be written twice. This introduces a race condition
2438+
> between threads, and is a potential security vulnerability. There is no safe,
2439+
> cross-platform alternative API.
2440+
2441+
`process.umask()` returns the Node.js process's file mode creation mask. Child
2442+
processes inherit the mask from the parent process.
2443+
2444+
## `process.umask(mask)`
2445+
<!-- YAML
2446+
added: v0.1.19
2447+
-->
24382448

24392449
* `mask` {string|integer}
24402450

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

24462454
```js
24472455
const newmask = 0o022;
@@ -2451,8 +2459,7 @@ console.log(
24512459
);
24522460
```
24532461

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

24572464
## `process.uptime()`
24582465
<!-- YAML

0 commit comments

Comments
 (0)