summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/process.ts
diff options
context:
space:
mode:
authorSatya Rohith <me@satyarohith.com>2024-02-23 19:06:17 +0530
committerGitHub <noreply@github.com>2024-02-23 14:36:17 +0100
commit156cfe5c90a18d838979d143046698d0ac3f1072 (patch)
treee942712d8c36be3a028070db5a7696cafd757f73 /ext/node/polyfills/process.ts
parentf49abcc1ac3de72bf894ccfc0102d83ec19f1d46 (diff)
fix(ext/node): init arch, pid, platform at startup (#22561)
Diffstat (limited to 'ext/node/polyfills/process.ts')
-rw-r--r--ext/node/polyfills/process.ts16
1 files changed, 4 insertions, 12 deletions
diff --git a/ext/node/polyfills/process.ts b/ext/node/polyfills/process.ts
index a8da35f70..518718470 100644
--- a/ext/node/polyfills/process.ts
+++ b/ext/node/polyfills/process.ts
@@ -48,13 +48,10 @@ import { Command } from "ext:runtime/40_process.js";
let argv0Getter = () => "";
export let argv0 = "deno";
-// TODO(kt3k): This should be set at start up time
export let arch = "";
-// TODO(kt3k): This should be set at start up time
export let platform = "";
-// TODO(kt3k): This should be set at start up time
export let pid = 0;
let stdin, stdout, stderr;
@@ -368,9 +365,6 @@ class Process extends EventEmitter {
/** https://nodejs.org/api/process.html#process_process_arch */
get arch() {
- if (!arch) {
- arch = arch_();
- }
return arch;
}
@@ -561,9 +555,6 @@ class Process extends EventEmitter {
/** https://nodejs.org/api/process.html#process_process_pid */
get pid() {
- if (!pid) {
- pid = Deno.pid;
- }
return pid;
}
@@ -574,9 +565,6 @@ class Process extends EventEmitter {
/** https://nodejs.org/api/process.html#process_process_platform */
get platform() {
- if (!platform) {
- platform = isWindows ? "win32" : Deno.build.os;
- }
return platform;
}
@@ -939,6 +927,10 @@ internals.__bootstrapNodeProcess = function (
process.setStartTime(Date.now());
+ arch = arch_();
+ platform = isWindows ? "win32" : Deno.build.os;
+ pid = Deno.pid;
+
// @ts-ignore Remove setStartTime and #startTime is not modifiable
delete process.setStartTime;
delete internals.__bootstrapNodeProcess;