mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 15:49:44 -05:00
loadavg and osRelease made unstable (#4938)
This commit is contained in:
parent
95a08857f1
commit
f2d5e6f58a
2 changed files with 8 additions and 0 deletions
6
cli/js/lib.deno.ns.d.ts
vendored
6
cli/js/lib.deno.ns.d.ts
vendored
|
@ -97,6 +97,9 @@ declare namespace Deno {
|
|||
* console.log(Deno.loadavg()); // e.g. [ 0.71, 0.44, 0.44 ]
|
||||
*
|
||||
* Requires `allow-env` permission.
|
||||
*
|
||||
* **Unstable** There are questions around which permission this needs. And
|
||||
* maybe should be renamed (loadAverage?)
|
||||
*/
|
||||
export function loadavg(): number[];
|
||||
|
||||
|
@ -113,6 +116,9 @@ declare namespace Deno {
|
|||
* console.log(Deno.osRelease());
|
||||
*
|
||||
* Requires `allow-env` permission.
|
||||
*
|
||||
* **Unstable** new API maybe move to Deno.build or Deno.versions? Depends on
|
||||
* sys-info, which we don't necessarally want to depend on.
|
||||
*/
|
||||
export function osRelease(): string;
|
||||
|
||||
|
|
|
@ -156,6 +156,7 @@ fn op_loadavg(
|
|||
_args: Value,
|
||||
_zero_copy: Option<ZeroCopyBuf>,
|
||||
) -> Result<JsonOp, OpError> {
|
||||
state.check_unstable("Deno.loadavg");
|
||||
state.check_env()?;
|
||||
match sys_info::loadavg() {
|
||||
Ok(loadavg) => Ok(JsonOp::Sync(json!([
|
||||
|
@ -182,6 +183,7 @@ fn op_os_release(
|
|||
_args: Value,
|
||||
_zero_copy: Option<ZeroCopyBuf>,
|
||||
) -> Result<JsonOp, OpError> {
|
||||
state.check_unstable("Deno.osRelease");
|
||||
state.check_env()?;
|
||||
let release = sys_info::os_release().unwrap_or_else(|_| "".to_string());
|
||||
Ok(JsonOp::Sync(json!(release)))
|
||||
|
|
Loading…
Reference in a new issue