summaryrefslogtreecommitdiff
path: root/cli/js/ops/os.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-07-19 19:49:44 +0200
committerGitHub <noreply@github.com>2020-07-19 19:49:44 +0200
commitfa61956f03491101b6ef64423ea2f1f73af26a73 (patch)
treec3800702071ca78aa4dd71bdd0a59a9bbe460bdd /cli/js/ops/os.ts
parent53adde866dd399aa2509d14508642fce37afb8f5 (diff)
Port internal TS code to JS (#6793)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
Diffstat (limited to 'cli/js/ops/os.ts')
-rw-r--r--cli/js/ops/os.ts45
1 files changed, 0 insertions, 45 deletions
diff --git a/cli/js/ops/os.ts b/cli/js/ops/os.ts
deleted file mode 100644
index 50234ee4b..000000000
--- a/cli/js/ops/os.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-
-import { sendSync } from "./dispatch_json.ts";
-
-export function loadavg(): number[] {
- return sendSync("op_loadavg");
-}
-
-export function hostname(): string {
- return sendSync("op_hostname");
-}
-
-export function osRelease(): string {
- return sendSync("op_os_release");
-}
-
-export function exit(code = 0): never {
- sendSync("op_exit", { code });
- throw new Error("Code not reachable");
-}
-
-function setEnv(key: string, value: string): void {
- sendSync("op_set_env", { key, value });
-}
-
-function getEnv(key: string): string | undefined {
- return sendSync("op_get_env", { key })[0];
-}
-
-function deleteEnv(key: string): void {
- sendSync("op_delete_env", { key });
-}
-
-export const env = {
- get: getEnv,
- toObject(): Record<string, string> {
- return sendSync("op_env");
- },
- set: setEnv,
- delete: deleteEnv,
-};
-
-export function execPath(): string {
- return sendSync("op_exec_path");
-}