From 153524300829565b43635efa11a67bde90b99854 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 7 Apr 2020 16:17:14 -0700 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/32711 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- doc/api/deprecations.md | 2 +- doc/api/process.md | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 4b2c7da0474a70..c9dffe269e3ffb 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -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. 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()`