summaryrefslogtreecommitdiff
path: root/ext/node
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2024-05-15 22:02:11 -0700
committerGitHub <noreply@github.com>2024-05-16 10:32:11 +0530
commita31b81394b7d78e6a0e678ba4d18dda62a3b2bc5 (patch)
tree7e104ab27ac11826b423d99b442e3dd0539e4af1 /ext/node
parentf6c6e768c83d7de44b5b8a7411e7679f7c9ac2b9 (diff)
fix(ext/node): export geteuid from node:process (#23840)
Fixes https://github.com/denoland/deno/issues/23827
Diffstat (limited to 'ext/node')
-rw-r--r--ext/node/polyfills/process.ts22
1 files changed, 13 insertions, 9 deletions
diff --git a/ext/node/polyfills/process.ts b/ext/node/polyfills/process.ts
index 1a96af2a2..c281cab44 100644
--- a/ext/node/polyfills/process.ts
+++ b/ext/node/polyfills/process.ts
@@ -301,6 +301,16 @@ export function kill(pid: number, sig: string | number = "SIGTERM") {
return true;
}
+let getgid, getuid, geteuid;
+
+if (!isWindows) {
+ getgid = () => Deno.gid();
+ getuid = () => Deno.uid();
+ geteuid = () => op_geteuid();
+}
+
+export { geteuid, getgid, getuid };
+
// deno-lint-ignore no-explicit-any
function uncaughtExceptionHandler(err: any, origin: string) {
// The origin parameter can be 'unhandledRejection' or 'uncaughtException'
@@ -638,19 +648,13 @@ class Process extends EventEmitter {
}
/** This method is removed on Windows */
- getgid?(): number {
- return Deno.gid()!;
- }
+ getgid = getgid;
/** This method is removed on Windows */
- getuid?(): number {
- return Deno.uid()!;
- }
+ getuid = getuid;
/** This method is removed on Windows */
- geteuid?(): number {
- return op_geteuid();
- }
+ geteuid = geteuid;
// TODO(kt3k): Implement this when we added -e option to node compat mode
_eval: string | undefined = undefined;