From c3c94c0943b9e5536d5adf243e9e6777594cb774 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 26 Dec 2018 06:14:54 -0800 Subject: [PATCH 1/2] test: set umask for tests https://github.com/nodejs/node/pull/25213 proposes setting umask in the Python test runner to avoid spurious test failures when running from a shell with a restrictive umask. This is a good idea, but will only fix the issue for tests run with the Python runner. Set it in `common/index.js` as well so that it fixes it even when tests are run directly with a `node` binary, bypassing the Python test runner. --- test/common/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/common/index.js b/test/common/index.js index 5d9a4b31e36534..724d5f1486dc56 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -34,6 +34,10 @@ const { hasIntl } = process.binding('config'); +// Some tests assume a umask of 0o022 so set that up front. Tests that need a +// different umask will set it themselves. +process.umask(0o022); + const noop = () => {}; const hasCrypto = Boolean(process.versions.openssl); From 8036a8bd9d449460947df5b3966e27d9c30ee7ee Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 9 Jan 2019 13:59:21 -0800 Subject: [PATCH 2/2] fixup! test: set umask for tests --- test/common/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/common/index.js b/test/common/index.js index 724d5f1486dc56..924d077c1d907f 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -36,7 +36,11 @@ const { // Some tests assume a umask of 0o022 so set that up front. Tests that need a // different umask will set it themselves. -process.umask(0o022); +// +// process.umask() is not available in workers so we need to check for its +// existence. +if (process.umask) + process.umask(0o022); const noop = () => {};