mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
Add execPath function (#1743)
This commit is contained in:
parent
1d7c74e9b5
commit
4dc4329e27
6 changed files with 26 additions and 4 deletions
|
@ -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,
|
||||
|
|
12
js/os.ts
12
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue