diff --git a/cli/dts/lib.deno.ns.d.ts b/cli/dts/lib.deno.ns.d.ts index 518b81eddb..f9baddb063 100644 --- a/cli/dts/lib.deno.ns.d.ts +++ b/cli/dts/lib.deno.ns.d.ts @@ -3762,8 +3762,8 @@ declare namespace Deno { | "systemMemoryInfo" | "networkInterfaces" | "osRelease" - | "getUid" - | "getGid"; + | "uid" + | "gid"; } /** The permission descriptor for the `allow-ffi` permissions, which controls diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts index 2bcba88da0..992e57185a 100644 --- a/cli/dts/lib.deno.unstable.d.ts +++ b/cli/dts/lib.deno.unstable.d.ts @@ -359,7 +359,7 @@ declare namespace Deno { * on Windows. * * ```ts - * console.log(Deno.getUid()); + * console.log(Deno.uid()); * ``` * * Requires `allow-sys` permission. @@ -367,7 +367,7 @@ declare namespace Deno { * @tags allow-sys * @category Runtime Environment */ - export function getUid(): number | null; + export function uid(): number | null; /** **UNSTABLE**: New API, yet to be vetted. * @@ -375,7 +375,7 @@ declare namespace Deno { * Windows. * * ```ts - * console.log(Deno.getGid()); + * console.log(Deno.gid()); * ``` * * Requires `allow-sys` permission. @@ -383,7 +383,7 @@ declare namespace Deno { * @tags allow-sys * @category Runtime Environment */ - export function getGid(): number | null; + export function gid(): number | null; /** **UNSTABLE**: New API, yet to be vetted. * diff --git a/cli/tests/unit/os_test.ts b/cli/tests/unit/os_test.ts index d620ae4e35..a7329ddb4d 100644 --- a/cli/tests/unit/os_test.ts +++ b/cli/tests/unit/os_test.ts @@ -241,21 +241,21 @@ Deno.test( }, ); -Deno.test({ permissions: { sys: ["getUid"] } }, function getUid() { +Deno.test({ permissions: { sys: ["uid"] } }, function getUid() { if (Deno.build.os === "windows") { - assertEquals(Deno.getUid(), null); + assertEquals(Deno.uid(), null); } else { - const uid = Deno.getUid(); + const uid = Deno.uid(); assert(typeof uid === "number"); assert(uid > 0); } }); -Deno.test({ permissions: { sys: ["getGid"] } }, function getGid() { +Deno.test({ permissions: { sys: ["gid"] } }, function getGid() { if (Deno.build.os === "windows") { - assertEquals(Deno.getGid(), null); + assertEquals(Deno.gid(), null); } else { - const gid = Deno.getGid(); + const gid = Deno.gid(); assert(typeof gid === "number"); assert(gid > 0); } diff --git a/cli/tests/unit/permissions_test.ts b/cli/tests/unit/permissions_test.ts index c0945bb598..3387913e87 100644 --- a/cli/tests/unit/permissions_test.ts +++ b/cli/tests/unit/permissions_test.ts @@ -25,8 +25,8 @@ Deno.test(async function permissionSysValidKind() { await Deno.permissions.query({ name: "sys", kind: "networkInterfaces" }); await Deno.permissions.query({ name: "sys", kind: "systemMemoryInfo" }); await Deno.permissions.query({ name: "sys", kind: "hostname" }); - await Deno.permissions.query({ name: "sys", kind: "getUid" }); - await Deno.permissions.query({ name: "sys", kind: "getGid" }); + await Deno.permissions.query({ name: "sys", kind: "uid" }); + await Deno.permissions.query({ name: "sys", kind: "gid" }); }); Deno.test(async function permissionSysInvalidKind() { diff --git a/runtime/js/30_os.js b/runtime/js/30_os.js index 4fa71fa832..723b521329 100644 --- a/runtime/js/30_os.js +++ b/runtime/js/30_os.js @@ -33,12 +33,12 @@ return ops.op_network_interfaces(); } - function getGid() { - return ops.op_getgid(); + function gid() { + return ops.op_gid(); } - function getUid() { - return ops.op_getuid(); + function uid() { + return ops.op_uid(); } // This is an internal only method used by the test harness to override the @@ -101,13 +101,13 @@ env, execPath, exit, - getGid, - getUid, + gid, hostname, loadavg, networkInterfaces, osRelease, setExitHandler, systemMemoryInfo, + uid, }; })(this); diff --git a/runtime/js/90_deno_ns.js b/runtime/js/90_deno_ns.js index 00d343f747..1f949f512a 100644 --- a/runtime/js/90_deno_ns.js +++ b/runtime/js/90_deno_ns.js @@ -128,8 +128,8 @@ osRelease: __bootstrap.os.osRelease, systemMemoryInfo: __bootstrap.os.systemMemoryInfo, networkInterfaces: __bootstrap.os.networkInterfaces, - getGid: __bootstrap.os.getGid, - getUid: __bootstrap.os.getUid, + gid: __bootstrap.os.gid, + uid: __bootstrap.os.uid, listenDatagram: __bootstrap.net.listenDatagram, umask: __bootstrap.fs.umask, HttpClient: __bootstrap.fetch.HttpClient, diff --git a/runtime/ops/os.rs b/runtime/ops/os.rs index 2aafdc7a36..35b49217c9 100644 --- a/runtime/ops/os.rs +++ b/runtime/ops/os.rs @@ -20,8 +20,7 @@ fn init_ops(builder: &mut ExtensionBuilder) -> &mut ExtensionBuilder { op_exit::decl(), op_delete_env::decl(), op_get_env::decl(), - op_getgid::decl(), - op_getuid::decl(), + op_gid::decl(), op_hostname::decl(), op_loadavg::decl(), op_network_interfaces::decl(), @@ -29,6 +28,7 @@ fn init_ops(builder: &mut ExtensionBuilder) -> &mut ExtensionBuilder { op_set_env::decl(), op_set_exit_code::decl(), op_system_memory_info::decl(), + op_uid::decl(), ]) } @@ -284,12 +284,12 @@ fn op_system_memory_info( #[cfg(not(windows))] #[op] -fn op_getgid(state: &mut OpState) -> Result, AnyError> { - super::check_unstable(state, "Deno.getGid"); +fn op_gid(state: &mut OpState) -> Result, AnyError> { + super::check_unstable(state, "Deno.gid"); state .borrow_mut::() .sys - .check("getGid", Some("Deno.getGid()"))?; + .check("gid", Some("Deno.gid()"))?; // TODO(bartlomieju): #[allow(clippy::undocumented_unsafe_blocks)] unsafe { @@ -299,23 +299,23 @@ fn op_getgid(state: &mut OpState) -> Result, AnyError> { #[cfg(windows)] #[op] -fn op_getgid(state: &mut OpState) -> Result, AnyError> { - super::check_unstable(state, "Deno.getGid"); +fn op_gid(state: &mut OpState) -> Result, AnyError> { + super::check_unstable(state, "Deno.gid"); state .borrow_mut::() .sys - .check("getGid", Some("Deno.getGid()"))?; + .check("gid", Some("Deno.gid()"))?; Ok(None) } #[cfg(not(windows))] #[op] -fn op_getuid(state: &mut OpState) -> Result, AnyError> { - super::check_unstable(state, "Deno.getUid"); +fn op_uid(state: &mut OpState) -> Result, AnyError> { + super::check_unstable(state, "Deno.uid"); state .borrow_mut::() .sys - .check("getUid", Some("Deno.getUid()"))?; + .check("uid", Some("Deno.uid()"))?; // TODO(bartlomieju): #[allow(clippy::undocumented_unsafe_blocks)] unsafe { @@ -325,11 +325,11 @@ fn op_getuid(state: &mut OpState) -> Result, AnyError> { #[cfg(windows)] #[op] -fn op_getuid(state: &mut OpState) -> Result, AnyError> { - super::check_unstable(state, "Deno.getUid"); +fn op_uid(state: &mut OpState) -> Result, AnyError> { + super::check_unstable(state, "Deno.uid"); state .borrow_mut::() .sys - .check("getUid", Some("Deno.getUid()"))?; + .check("uid", Some("Deno.uid()"))?; Ok(None) } diff --git a/runtime/permissions.rs b/runtime/permissions.rs index ec2f146ae3..95f95b5122 100644 --- a/runtime/permissions.rs +++ b/runtime/permissions.rs @@ -308,7 +308,7 @@ pub struct SysDescriptor(pub String); pub fn parse_sys_kind(kind: &str) -> Result<&str, AnyError> { match kind { "hostname" | "osRelease" | "loadavg" | "networkInterfaces" - | "systemMemoryInfo" | "getUid" | "getGid" => Ok(kind), + | "systemMemoryInfo" | "uid" | "gid" => Ok(kind), _ => Err(type_error(format!("unknown system info kind \"{}\"", kind))), } } diff --git a/test_util/std b/test_util/std index f2c97ea9c3..e26ced48ce 160000 --- a/test_util/std +++ b/test_util/std @@ -1 +1 @@ -Subproject commit f2c97ea9c382fb3e225929c7650934417e2fc8c9 +Subproject commit e26ced48ce65f1ab0e3bd2fc6e393b9ad526c6fe