summaryrefslogtreecommitdiff
path: root/test/common/index.js
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2019-01-15 15:39:43 -0500
committercjihrig <cjihrig@gmail.com>2019-01-17 16:32:21 -0500
commitf6cd4e3e5976ce9edccdb13933028bdc95d43df4 (patch)
tree4eb1583e5776f3b544e4096e67b72d54cbca28ef /test/common/index.js
parent1375af204a30d1885b9e8bf79725cbd223707439 (diff)
downloadandroid-node-v8-f6cd4e3e5976ce9edccdb13933028bdc95d43df4.tar.gz
android-node-v8-f6cd4e3e5976ce9edccdb13933028bdc95d43df4.tar.bz2
android-node-v8-f6cd4e3e5976ce9edccdb13933028bdc95d43df4.zip
process: allow reading umask in workers
Refs: https://github.com/nodejs/node/issues/25448 PR-URL: https://github.com/nodejs/node/pull/25526 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'test/common/index.js')
-rw-r--r--test/common/index.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/test/common/index.js b/test/common/index.js
index c1fb28121e..72ad0c3b77 100644
--- a/test/common/index.js
+++ b/test/common/index.js
@@ -33,21 +33,20 @@ const {
bits,
hasIntl
} = process.binding('config');
+const { isMainThread } = require('worker_threads');
// Some tests assume a umask of 0o022 so set that up front. Tests that need a
// different umask will set it themselves.
//
-// process.umask() is not available in workers so we need to check for its
-// existence.
-if (process.umask)
+// Workers can read, but not set the umask, so check that this is the main
+// thread.
+if (isMainThread)
process.umask(0o022);
const noop = () => {};
const hasCrypto = Boolean(process.versions.openssl);
-const { isMainThread } = require('worker_threads');
-
// Check for flags. Skip this for workers (both, the `cluster` module and
// `worker_threads`) and child processes.
if (process.argv.length === 2 &&