diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index bb3224a7360686..9425ae1e24ab5b 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -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. diff --git a/doc/api/process.md b/doc/api/process.md index f15bfcc2be09cb..4fff2a877ce687 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -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()` -> 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; @@ -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()`