Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: Runtime

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