summaryrefslogtreecommitdiff
path: root/js/os.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/os.ts')
-rw-r--r--js/os.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/js/os.ts b/js/os.ts
index 0e4d86917..a26f57cb3 100644
--- a/js/os.ts
+++ b/js/os.ts
@@ -18,6 +18,15 @@ export function isTTY(): { stdin: boolean; stdout: boolean; stderr: boolean } {
return sendSync(dispatch.OP_IS_TTY);
}
+/** Get the hostname.
+ * Requires the `--allow-env` flag.
+ *
+ * console.log(Deno.hostname());
+ */
+export function hostname(): string {
+ return sendSync(dispatch.OP_HOSTNAME);
+}
+
/** Exit the Deno process with optional exit code. */
export function exit(code = 0): never {
sendSync(dispatch.OP_EXIT, { code });