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

Added partial support for node:os > userInfo function #19945

Closed
wants to merge 2 commits into from

Conversation

zeachco
Copy link

@zeachco zeachco commented Jul 26, 2023

Most packages in node uses os.userInfo to read username, shell or homedir. this changes still causes an exception on trying to read uid and gid and supports only utf-8 option for now but that's a start.

impact

While this isn't an accurate implementation, some npm packages such as https://www.npmjs.com/package/atomically (which is used by remix and many other projects) depends on it and would make a large chunk of the npm ecosystem workable, making deno more adoptable

this is linked to #17850

This feels like a "poorman solution" but if any insights on integrating [gu]id is provided I would gladly try my best to address it.

propositions:

  • maybe we could put that behind an unstable flag while it's a temp / partial implementation?
    something like deno run --unstable-os-user-info npm:<package>
image

@CLAassistant
Copy link

CLAassistant commented Jul 26, 2023

CLA assistant check
All committers have signed the CLA.

@zeachco zeachco force-pushed the main branch 2 times, most recently from 53e3dc9 to f871aa7 Compare July 26, 2023 18:37
most packages in node uses os.userInfo to read username, shell or
homedir. this changes still causes an exception on trying to read uid
and gid and supports only utf-8 option for now but that's a start.
const homedir = Deno.env.get("HOME");
const shell = Deno.env.get("SHELL") || null;

if (!username || !homedir) throw codes.SYSERR;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should I throw notImplemented(SEE_GITHUB_ISSUE); here too? node does a system error when those aren't set

Comment on lines +335 to +336
uid: -1,
gid: -1,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we warn about uid/gid in the cli?

@zeachco zeachco changed the title Added partial support for node:os > userInfo function (everything except uid and gid) Added partial support for node:os > userInfo function Jul 26, 2023
@bartlomieju
Copy link
Member

Thanks for the PR @zeachco, FYI there's already a PR that implements these APIs (#19370) and it's supposed to land before v1.36 is released.

@zeachco
Copy link
Author

zeachco commented Jul 26, 2023

Awesome, I wasn't sure if that or would cut in the next version hence the quick minimalistic one. Great to hear. I'll close this one

@zeachco zeachco closed this Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants