mirror of
https://github.com/denoland/deno.git
synced 2025-01-11 08:33:43 -05:00
fix(node): add ppid
getter for node:process
(#22167)
This commit adds `ppid` getter for `node:process` to improve Node compatibility one step further. There is one problem though, which is that `Deno.ppid`, which `process.ppid` internally calls, is actually of type `bigint` although it's supposed to be `number`. I filed an issue for this (#22166). For the time being, explciit type conversion from `bigint` to `number` is applied to match the Node.js behavior.
This commit is contained in:
parent
cfb57b1855
commit
66e6ed65e9
2 changed files with 13 additions and 0 deletions
|
@ -121,6 +121,14 @@ Deno.test({
|
|||
},
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "process.ppid",
|
||||
fn() {
|
||||
assertEquals(typeof process.ppid, "number");
|
||||
assertEquals(process.ppid, Deno.ppid);
|
||||
},
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "process.on",
|
||||
async fn() {
|
||||
|
|
|
@ -558,6 +558,11 @@ class Process extends EventEmitter {
|
|||
return pid;
|
||||
}
|
||||
|
||||
/** https://nodejs.org/api/process.html#processppid */
|
||||
get ppid() {
|
||||
return Deno.ppid;
|
||||
}
|
||||
|
||||
/** https://nodejs.org/api/process.html#process_process_platform */
|
||||
get platform() {
|
||||
if (!platform) {
|
||||
|
|
Loading…
Reference in a new issue