summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-08-04 14:31:13 +0200
committerGitHub <noreply@github.com>2023-08-04 14:31:13 +0200
commit6405b5f454e140b0d79b603b0627debd246c7b9f (patch)
tree8d95d47b66f1cdc3f149181654894aab252e2c65
parent8d8a89ceea9edd5c1f3519769d4c1861e232719d (diff)
fix(node): polyfill process.title (#20044)
Closes https://github.com/denoland/deno/issues/19777
-rw-r--r--cli/tests/unit_node/process_test.ts10
-rw-r--r--ext/node/polyfills/process.ts10
2 files changed, 20 insertions, 0 deletions
diff --git a/cli/tests/unit_node/process_test.ts b/cli/tests/unit_node/process_test.ts
index 7e927a8ad..461afb9f6 100644
--- a/cli/tests/unit_node/process_test.ts
+++ b/cli/tests/unit_node/process_test.ts
@@ -764,3 +764,13 @@ Deno.test({
assert(typeof process.stdout.isTTY === "boolean");
},
});
+
+Deno.test({
+ name: "process.title",
+ fn() {
+ assertEquals(process.title, "deno");
+ // Verify that setting the value has no effect.
+ process.title = "foo";
+ assertEquals(process.title, "deno");
+ },
+});
diff --git a/ext/node/polyfills/process.ts b/ext/node/polyfills/process.ts
index b0a4d04c8..2f1c2968f 100644
--- a/ext/node/polyfills/process.ts
+++ b/ext/node/polyfills/process.ts
@@ -364,6 +364,16 @@ class Process extends EventEmitter {
return arch;
}
+ get title() {
+ return "deno";
+ }
+
+ set title(_value) {
+ // NOTE(bartlomieju): this is a noop. Node.js doesn't guarantee that the
+ // process name will be properly set and visible from other tools anyway.
+ // Might revisit in the future.
+ }
+
/**
* https://nodejs.org/api/process.html#process_process_argv
* Read permissions are required in order to get the executable route