-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
process: backport process/methods file
To ease future backports, create the process/methods file introduced in #19973. This commit just adds the JS functions that forward calls to C++ and does not change type checking. PR-URL: #21172 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
- Loading branch information
Showing
4 changed files
with
67 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
'use strict'; | ||
|
||
function setupProcessMethods() { | ||
// Non-POSIX platforms like Windows don't have certain methods. | ||
if (process.setgid !== undefined) { | ||
setupPosixMethods(); | ||
} | ||
|
||
const { chdir: _chdir, umask: _umask } = process; | ||
|
||
process.chdir = chdir; | ||
process.umask = umask; | ||
|
||
function chdir(...args) { | ||
return _chdir(...args); | ||
} | ||
|
||
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 initgroups(...args) { | ||
return _initgroups(...args); | ||
} | ||
|
||
function setegid(...args) { | ||
return _setegid(...args); | ||
} | ||
|
||
function seteuid(...args) { | ||
return _seteuid(...args); | ||
} | ||
|
||
function setgid(...args) { | ||
return _setgid(...args); | ||
} | ||
|
||
function setuid(...args) { | ||
return _setuid(...args); | ||
} | ||
|
||
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
File renamed without changes.