-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
added osType() function #5714
added osType() function #5714
Conversation
You should be able to get tests to pass by updating the diff --git a/std/node/os_test.ts b/std/node/os_test.ts
index f0b9ca79..c67879d2 100644
--- a/std/node/os_test.ts
+++ b/std/node/os_test.ts
@@ -244,13 +244,6 @@ test({
Error,
"Not implemented"
);
- assertThrows(
- () => {
- os.type();
- },
- Error,
- "Not implemented"
- );
assertThrows(
() => {
os.uptime(); |
cli/js/lib.deno.ns.d.ts
Outdated
@@ -155,6 +155,8 @@ declare namespace Deno { | |||
*/ | |||
export function execPath(): string; | |||
|
|||
export function osType(): string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi - thanks for the patch - but in order to add new APIs they need to first be unstable. Please move this declaration to cli/js/lib.deno.unstable.d.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
cli/ops/os.rs
Outdated
_zero_copy: Option<ZeroCopyBuf>, | ||
) -> Result<JsonOp, OpError> { | ||
state.check_env()?; | ||
let os_type = sys_info::os_type().unwrap_or_else(|_| "".to_string()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a check_unstable call here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ry made the changes
@ry any updates on this? |
@@ -190,9 +190,9 @@ export function totalmem(): number { | |||
notImplemented(SEE_GITHUB_ISSUE); | |||
} | |||
|
|||
/** Not yet implemented */ | |||
/** Returns the operating system name as returned by uname(3) */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Nitpick:
- If this function returns the host's
uname(3)
, then it might be better to call itosName()
instead ofosType()
. The latter could be taken differently; i.e., referring to the operating system family (POSIX, Windows, Android, iOS, etc). At least, that was my immediate interpretation of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AleksandrukTad changed them as you asked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thanks @rubiin - sorry for the delay!
No biggie :) |
@rubiin Something just occurred to me - how is this different than |
I got this:
vs
|
Deno.build.os provides the same functionality This reverts commit 6ccf903.
No description provided.