forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: refactor bootstrap to use bootstrap object
PR-URL: nodejs#20917 Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
- Loading branch information
Showing
9 changed files
with
244 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,49 @@ | ||
'use strict'; | ||
|
||
function setupProcessMethods() { | ||
function setupProcessMethods(_chdir, _cpuUsage, _hrtime, _memoryUsage, | ||
_rawDebug, _umask, _initgroups, _setegid, | ||
_seteuid, _setgid, _setuid, _setgroups) { | ||
// Non-POSIX platforms like Windows don't have certain methods. | ||
if (process.setgid !== undefined) { | ||
setupPosixMethods(); | ||
if (_setgid !== undefined) { | ||
setupPosixMethods(_initgroups, _setegid, _seteuid, | ||
_setgid, _setuid, _setgroups); | ||
} | ||
|
||
const { chdir: _chdir, umask: _umask } = process; | ||
|
||
process.chdir = chdir; | ||
process.umask = umask; | ||
|
||
function chdir(...args) { | ||
process.chdir = function chdir(...args) { | ||
return _chdir(...args); | ||
} | ||
}; | ||
|
||
function umask(...args) { | ||
process.umask = function umask(...args) { | ||
return _umask(...args); | ||
} | ||
}; | ||
} | ||
|
||
function setupPosixMethods() { | ||
const { | ||
initgroups: _initgroups, | ||
setegid: _setegid, | ||
seteuid: _seteuid, | ||
setgid: _setgid, | ||
setuid: _setuid, | ||
setgroups: _setgroups | ||
} = process; | ||
|
||
process.initgroups = initgroups; | ||
process.setegid = setegid; | ||
process.seteuid = seteuid; | ||
process.setgid = setgid; | ||
process.setuid = setuid; | ||
process.setgroups = setgroups; | ||
function setupPosixMethods(_initgroups, _setegid, _seteuid, | ||
_setgid, _setuid, _setgroups) { | ||
|
||
function initgroups(...args) { | ||
process.initgroups = function initgroups(...args) { | ||
return _initgroups(...args); | ||
} | ||
}; | ||
|
||
function setegid(...args) { | ||
process.setegid = function setegid(...args) { | ||
return _setegid(...args); | ||
} | ||
}; | ||
|
||
function seteuid(...args) { | ||
process.seteuid = function seteuid(...args) { | ||
return _seteuid(...args); | ||
} | ||
}; | ||
|
||
function setgid(...args) { | ||
process.setgid = function setgid(...args) { | ||
return _setgid(...args); | ||
} | ||
}; | ||
|
||
function setuid(...args) { | ||
process.setuid = function setuid(...args) { | ||
return _setuid(...args); | ||
} | ||
}; | ||
|
||
function setgroups(...args) { | ||
process.setgroups = function setgroups(...args) { | ||
return _setgroups(...args); | ||
} | ||
}; | ||
} | ||
|
||
exports.setup = setupProcessMethods; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.