summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2020-06-12 09:53:53 -0400
committerGitHub <noreply@github.com>2020-06-12 09:53:53 -0400
commite9424bf6b59b4e27c2691b70879cb1de874f98ce (patch)
tree3a11c12f74f1f2e86c38814620961a0532f38812
parentb34f4689430db67d98aa037193a118bc088e48d6 (diff)
Revert "feat: add Deno.osName()" (#6261)
Deno.build.os provides the same functionality This reverts commit 6ccf9037a6b36c81ea0e6ac12d0e2dbd793f6114.
-rw-r--r--cli/doc/ts_type.rs4
-rw-r--r--cli/js/deno.ts2
-rw-r--r--cli/js/lib.deno.unstable.d.ts12
-rw-r--r--cli/js/ops/os.ts4
-rw-r--r--cli/ops/os.rs12
-rw-r--r--cli/tests/unit/os_test.ts16
-rw-r--r--std/node/os.ts4
-rw-r--r--std/node/os_test.ts7
8 files changed, 12 insertions, 49 deletions
diff --git a/cli/doc/ts_type.rs b/cli/doc/ts_type.rs
index e1677f13e..ec1a5e7e9 100644
--- a/cli/doc/ts_type.rs
+++ b/cli/doc/ts_type.rs
@@ -529,7 +529,7 @@ impl Into<TsTypeDef> for &TsType {
TsUnionOrIntersectionType(union_or_inter) => union_or_inter.into(),
TsArrayType(array_type) => array_type.into(),
TsTupleType(tuple_type) => tuple_type.into(),
- TsTypeOperator(type_op_name) => type_op_name.into(),
+ TsTypeOperator(type_op_type) => type_op_type.into(),
TsParenthesizedType(paren_type) => paren_type.into(),
TsRestType(rest_type) => rest_type.into(),
TsOptionalType(optional_type) => optional_type.into(),
@@ -737,7 +737,7 @@ pub fn ts_type_ann_to_def(type_ann: &TsTypeAnn) -> TsTypeDef {
TsUnionOrIntersectionType(union_or_inter) => union_or_inter.into(),
TsArrayType(array_type) => array_type.into(),
TsTupleType(tuple_type) => tuple_type.into(),
- TsTypeOperator(type_op_name) => type_op_name.into(),
+ TsTypeOperator(type_op_type) => type_op_type.into(),
TsParenthesizedType(paren_type) => paren_type.into(),
TsRestType(rest_type) => rest_type.into(),
TsOptionalType(optional_type) => optional_type.into(),
diff --git a/cli/js/deno.ts b/cli/js/deno.ts
index e4211c23d..5bc69fc7b 100644
--- a/cli/js/deno.ts
+++ b/cli/js/deno.ts
@@ -53,7 +53,7 @@ export {
export { metrics, Metrics } from "./ops/runtime.ts";
export { mkdirSync, mkdir, MkdirOptions } from "./ops/fs/mkdir.ts";
export { connect, listen, Listener, Conn } from "./net.ts";
-export { dir, env, exit, execPath, osName } from "./ops/os.ts";
+export { env, exit, execPath } from "./ops/os.ts";
export { run, RunOptions, Process, ProcessStatus } from "./process.ts";
export { DirEntry, readDirSync, readDir } from "./ops/fs/read_dir.ts";
export { readFileSync, readFile } from "./read_file.ts";
diff --git a/cli/js/lib.deno.unstable.d.ts b/cli/js/lib.deno.unstable.d.ts
index f425dec56..dc50416fc 100644
--- a/cli/js/lib.deno.unstable.d.ts
+++ b/cli/js/lib.deno.unstable.d.ts
@@ -32,18 +32,6 @@ declare namespace Deno {
* Requires `allow-read` and `allow-write` permissions. */
export function linkSync(oldpath: string, newpath: string): void;
- /**
- * Returns the os name.
- *
- * ```ts
- * console.log(Deno.osName()); // e.g. "Linux"
- * ```
- *
- */
-
- export function osName(): string;
-
- /** Creates `newpath` as a hard link to `oldpath`.
/** **UNSTABLE**: This API needs a security review.
*
* Creates `newpath` as a hard link to `oldpath`.
diff --git a/cli/js/ops/os.ts b/cli/js/ops/os.ts
index 915106495..e63d8b358 100644
--- a/cli/js/ops/os.ts
+++ b/cli/js/ops/os.ts
@@ -72,7 +72,3 @@ export function dir(kind: DirKind): string | null {
export function execPath(): string {
return sendSync("op_exec_path");
}
-
-export function osName(): string {
- return sendSync("op_name");
-}
diff --git a/cli/ops/os.rs b/cli/ops/os.rs
index 77c547362..ab7ed2876 100644
--- a/cli/ops/os.rs
+++ b/cli/ops/os.rs
@@ -20,7 +20,6 @@ pub fn init(i: &mut CoreIsolate, s: &State) {
i.register_op("op_hostname", s.stateful_json_op(op_hostname));
i.register_op("op_loadavg", s.stateful_json_op(op_loadavg));
i.register_op("op_os_release", s.stateful_json_op(op_os_release));
- i.register_op("op_name", s.stateful_json_op(op_name));
}
#[derive(Deserialize)]
@@ -207,14 +206,3 @@ fn op_os_release(
let release = sys_info::os_release().unwrap_or_else(|_| "".to_string());
Ok(JsonOp::Sync(json!(release)))
}
-
-fn op_name(
- state: &State,
- _args: Value,
- _zero_copy: &mut [ZeroCopyBuf],
-) -> Result<JsonOp, OpError> {
- state.check_unstable("Deno.osName");
- state.check_env()?;
- let os_name = sys_info::os_type().unwrap_or_else(|_| "".to_string());
- Ok(JsonOp::Sync(json!(os_name)))
-}
diff --git a/cli/tests/unit/os_test.ts b/cli/tests/unit/os_test.ts
index deb0385a8..9698692c7 100644
--- a/cli/tests/unit/os_test.ts
+++ b/cli/tests/unit/os_test.ts
@@ -326,22 +326,6 @@ unitTest({ perms: { env: false } }, function hostnamePerm(): void {
assert(caughtError);
});
-unitTest({ perms: { env: true } }, function osName(): void {
- assertNotEquals(Deno.osName(), "");
-});
-
-unitTest({ perms: { env: false } }, function osNamePerm(): void {
- let caughtError = false;
- try {
- Deno.osName();
- } catch (err) {
- caughtError = true;
- assert(err instanceof Deno.errors.PermissionDenied);
- assertEquals(err.name, "PermissionDenied");
- }
- assert(caughtError);
-});
-
unitTest({ perms: { env: true } }, function releaseDir(): void {
assertNotEquals(Deno.osRelease(), "");
});
diff --git a/std/node/os.ts b/std/node/os.ts
index 65b158b3f..27b054f4d 100644
--- a/std/node/os.ts
+++ b/std/node/os.ts
@@ -190,9 +190,9 @@ export function totalmem(): number {
notImplemented(SEE_GITHUB_ISSUE);
}
-/** Returns the operating system name as returned by uname(3) */
+/** Not yet implemented */
export function type(): string {
- return Deno.osName();
+ notImplemented(SEE_GITHUB_ISSUE);
}
/** Not yet implemented */
diff --git a/std/node/os_test.ts b/std/node/os_test.ts
index c67879d23..f0b9ca79d 100644
--- a/std/node/os_test.ts
+++ b/std/node/os_test.ts
@@ -246,6 +246,13 @@ test({
);
assertThrows(
() => {
+ os.type();
+ },
+ Error,
+ "Not implemented"
+ );
+ assertThrows(
+ () => {
os.uptime();
},
Error,