mirror of
https://github.com/denoland/deno.git
synced 2024-12-25 00:29:09 -05:00
fix: enable "--allow-sys=cpus" for "deno run" (#22260)
Fixes #22221 with the suggested fix, and added "cpus" to the existing tests.
This commit is contained in:
parent
6c15dc3f06
commit
b16e6220a2
3 changed files with 5 additions and 2 deletions
|
@ -41,6 +41,7 @@ Deno.test(async function permissionSysValidKind() {
|
||||||
await Deno.permissions.query({ name: "sys", kind: "hostname" });
|
await Deno.permissions.query({ name: "sys", kind: "hostname" });
|
||||||
await Deno.permissions.query({ name: "sys", kind: "uid" });
|
await Deno.permissions.query({ name: "sys", kind: "uid" });
|
||||||
await Deno.permissions.query({ name: "sys", kind: "gid" });
|
await Deno.permissions.query({ name: "sys", kind: "gid" });
|
||||||
|
await Deno.permissions.query({ name: "sys", kind: "cpus" });
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test(function permissionSysValidKindSync() {
|
Deno.test(function permissionSysValidKindSync() {
|
||||||
|
@ -51,6 +52,7 @@ Deno.test(function permissionSysValidKindSync() {
|
||||||
Deno.permissions.querySync({ name: "sys", kind: "hostname" });
|
Deno.permissions.querySync({ name: "sys", kind: "hostname" });
|
||||||
Deno.permissions.querySync({ name: "sys", kind: "uid" });
|
Deno.permissions.querySync({ name: "sys", kind: "uid" });
|
||||||
Deno.permissions.querySync({ name: "sys", kind: "gid" });
|
Deno.permissions.querySync({ name: "sys", kind: "gid" });
|
||||||
|
Deno.permissions.querySync({ name: "sys", kind: "cpus" });
|
||||||
});
|
});
|
||||||
|
|
||||||
Deno.test(async function permissionSysInvalidKind() {
|
Deno.test(async function permissionSysInvalidKind() {
|
||||||
|
|
3
cli/tsc/dts/lib.deno.ns.d.ts
vendored
3
cli/tsc/dts/lib.deno.ns.d.ts
vendored
|
@ -4936,7 +4936,8 @@ declare namespace Deno {
|
||||||
| "osRelease"
|
| "osRelease"
|
||||||
| "osUptime"
|
| "osUptime"
|
||||||
| "uid"
|
| "uid"
|
||||||
| "gid";
|
| "gid"
|
||||||
|
| "cpus";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The permission descriptor for the `allow-ffi` and `deny-ffi` permissions, which controls
|
/** The permission descriptor for the `allow-ffi` and `deny-ffi` permissions, which controls
|
||||||
|
|
|
@ -688,7 +688,7 @@ impl Descriptor for SysDescriptor {
|
||||||
pub fn parse_sys_kind(kind: &str) -> Result<&str, AnyError> {
|
pub fn parse_sys_kind(kind: &str) -> Result<&str, AnyError> {
|
||||||
match kind {
|
match kind {
|
||||||
"hostname" | "osRelease" | "osUptime" | "loadavg" | "networkInterfaces"
|
"hostname" | "osRelease" | "osUptime" | "loadavg" | "networkInterfaces"
|
||||||
| "systemMemoryInfo" | "uid" | "gid" => Ok(kind),
|
| "systemMemoryInfo" | "uid" | "gid" | "cpus" => Ok(kind),
|
||||||
_ => Err(type_error(format!("unknown system info kind \"{kind}\""))),
|
_ => Err(type_error(format!("unknown system info kind \"{kind}\""))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue