summaryrefslogtreecommitdiff
path: root/lib/internal/process/methods.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/internal/process/methods.js')
-rw-r--r--lib/internal/process/methods.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/internal/process/methods.js b/lib/internal/process/methods.js
index 91aca398b3..9a954f6a9b 100644
--- a/lib/internal/process/methods.js
+++ b/lib/internal/process/methods.js
@@ -8,11 +8,18 @@ const {
validateMode,
validateUint32
} = require('internal/validators');
+const {
+ isMainThread
+} = require('internal/worker');
function setupProcessMethods(_chdir, _cpuUsage, _hrtime, _memoryUsage,
_rawDebug, _umask, _initgroups, _setegid,
_seteuid, _setgid, _setuid, _setgroups) {
// Non-POSIX platforms like Windows don't have certain methods.
+ // Workers also lack these methods since they change process-global state.
+ if (!isMainThread)
+ return;
+
if (_setgid !== undefined) {
setupPosixMethods(_initgroups, _setegid, _seteuid,
_setgid, _setuid, _setgroups);