Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loadavg and osRelease made unstable #4938

Merged
merged 1 commit into from
Apr 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cli/js/lib.deno.ns.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];

Expand All @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions cli/ops/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!([
Expand All @@ -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)))
Expand Down