diff options
author | Kevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com> | 2019-09-27 16:09:42 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-09-27 19:09:42 -0400 |
commit | 6efca6d1a17638136eadf39644f392f9107a4a6c (patch) | |
tree | 6aedab40214d21396122a97b4e6335a0f084a079 /js/os.ts | |
parent | d36391ad20afe56aaa6e42fd63597221636fdfcb (diff) |
Add Deno.hostname() (#3032)
Diffstat (limited to 'js/os.ts')
-rw-r--r-- | js/os.ts | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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 }); |