From a2bf61d1ae3ba2ff746a98ad2f0a96b6fc7782d0 Mon Sep 17 00:00:00 2001 From: uki00a Date: Wed, 8 Jul 2020 23:35:45 +0900 Subject: feat(unstable): Deno.ppid (#6539) --- cli/js/lib.deno.unstable.d.ts | 5 +++++ cli/js/ops/runtime.ts | 1 + cli/js/runtime_main.ts | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'cli/js') diff --git a/cli/js/lib.deno.unstable.d.ts b/cli/js/lib.deno.unstable.d.ts index 20096cb28..cec4f7f46 100644 --- a/cli/js/lib.deno.unstable.d.ts +++ b/cli/js/lib.deno.unstable.d.ts @@ -1194,4 +1194,9 @@ declare namespace Deno { * ``` */ export function fstat(rid: number): Promise; + + /** **UNSTABLE**: New API, yet to be vetted. + * The pid of the current process's parent. + */ + export const ppid: number; } diff --git a/cli/js/ops/runtime.ts b/cli/js/ops/runtime.ts index 70addf469..09208df6d 100644 --- a/cli/js/ops/runtime.ts +++ b/cli/js/ops/runtime.ts @@ -9,6 +9,7 @@ export interface Start { denoVersion: string; noColor: boolean; pid: number; + ppid: number; repl: boolean; target: string; tsVersion: string; diff --git a/cli/js/runtime_main.ts b/cli/js/runtime_main.ts index 25a6b0f93..0c579626b 100644 --- a/cli/js/runtime_main.ts +++ b/cli/js/runtime_main.ts @@ -96,10 +96,11 @@ export function bootstrapMainRuntime(): void { } }); - const { args, cwd, noColor, pid, repl, unstableFlag } = runtime.start(); + const { args, cwd, noColor, pid, ppid, repl, unstableFlag } = runtime.start(); Object.defineProperties(denoNs, { pid: readOnly(pid), + ppid: readOnly(ppid), noColor: readOnly(noColor), args: readOnly(Object.freeze(args)), }); -- cgit v1.2.3