From 4dc4329e270f617697154ca62a828cce3b46b348 Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov Date: Fri, 15 Feb 2019 19:22:02 +0300 Subject: Add execPath function (#1743) --- js/os.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'js/os.ts') diff --git a/js/os.ts b/js/os.ts index bb9ecc99a..fbcb23a7f 100644 --- a/js/os.ts +++ b/js/os.ts @@ -12,11 +12,19 @@ export let pid: number; /** Reflects the NO_COLOR environment variable: https://no-color.org/ */ export let noColor: boolean; +/** Path to the current deno process's executable file. */ +export let execPath: string; + /** @internal */ -export function setGlobals(pid_: number, noColor_: boolean): void { +export function setGlobals( + pid_: number, + noColor_: boolean, + execPath_: string +): void { assert(!pid); pid = pid_; noColor = noColor_; + execPath = execPath_; } interface CodeInfo { @@ -190,7 +198,7 @@ export function start(source?: string): msg.StartRes { util.setLogDebug(startResMsg.debugFlag(), source); - setGlobals(startResMsg.pid(), startResMsg.noColor()); + setGlobals(startResMsg.pid(), startResMsg.noColor(), startResMsg.execPath()!); return startResMsg; } -- cgit v1.2.3