All files / lib/internal/bootstrap/switches does_not_own_process_state.js

100% Statements 36/36
100% Branches 2/2
100% Functions 1/1
100% Lines 36/36

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 169x 1x 1x 1x 1x 1x 1x 1x 1x  
'use strict';
 
const credentials = internalBinding('credentials');
const rawMethods = internalBinding('process_methods');
// TODO: this should be detached from ERR_WORKER_UNSUPPORTED_OPERATION
const { unavailable } = require('internal/process/worker_thread_only');
 
process.abort = unavailable('process.abort()');
process.chdir = unavailable('process.chdir()');
process.umask = wrappedUmask;
process.cwd = rawMethods.cwd;
 
if (credentials.implementsPosixCredentials) {
  process.initgroups = unavailable('process.initgroups()');
  process.setgroups = unavailable('process.setgroups()');
  process.setegid = unavailable('process.setegid()');
  process.seteuid = unavailable('process.seteuid()');
  process.setgid = unavailable('process.setgid()');
  process.setuid = unavailable('process.setuid()');
}
 
// ---- keep the attachment of the wrappers above so that it's easier to ----
// ----              compare the setups side-by-side                    -----
 
const {
  codes: { ERR_WORKER_UNSUPPORTED_OPERATION }
} = require('internal/errors');
 
function wrappedUmask(mask) {
  // process.umask() is a read-only operation in workers.
  if (mask !== undefined) {
    throw new ERR_WORKER_UNSUPPORTED_OPERATION('Setting process.umask()');
  }
 
  return rawMethods.umask(mask);
}