summaryrefslogtreecommitdiff
path: root/test/common/index.js
diff options
context:
space:
mode:
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 &&