diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index c850c5c16cf781..c2bac5198243f4 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2547,15 +2547,15 @@ To maintain existing behaviour `response.finished` should be replaced with 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. diff --git a/doc/api/process.md b/doc/api/process.md index d9b776fdbc9f04..33a3debc0b53ea 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -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()` -> 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)` + * `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; @@ -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()`