summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorDmitry Sharshakov <sh7dm@outlook.com>2019-02-15 19:22:02 +0300
committerRyan Dahl <ry@tinyclouds.org>2019-02-15 11:22:02 -0500
commit4dc4329e270f617697154ca62a828cce3b46b348 (patch)
tree54edb5a9d3374fa6470fdc9ab5c50b9738dd4a35 /js
parent1d7c74e9b5c416c58b66246a6bbc907399fe9083 (diff)
Add execPath function (#1743)
Diffstat (limited to 'js')
-rw-r--r--js/deno.ts2
-rw-r--r--js/os.ts12
2 files changed, 11 insertions, 3 deletions
diff --git a/js/deno.ts b/js/deno.ts
index 45e16e52d..2e69a5bbd 100644
--- a/js/deno.ts
+++ b/js/deno.ts
@@ -1,7 +1,7 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
// Public deno module.
-export { noColor, pid, env, exit, isTTY } from "./os";
+export { noColor, pid, env, exit, isTTY, execPath } from "./os";
export { chdir, cwd } from "./dir";
export {
File,
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;
}