Skip to content

Refactor RealEnvStore methods to use uv_os_getenv/setenv/unsetenv #27211

Description

@joyeecheung

From a glance I think the uv_os_* methods are adequate to replace our conditional switches in the RealEnvStore methods.

I think this is a good first issue if you are familiar with C++ and has some idea on how to use libuv methods, but you may need to read into the libuv implementation to make sure the refactor does not change the functionality.

Pointers:

const char* val = getenv(*key);

setenv(*key, *val, 1);

if (getenv(*key)) return 0;

unsetenv(*key);

docs:

http://docs.libuv.org/en/v1.x/misc.html?highlight=uv_os_getenv#c.uv_os_getenv
http://docs.libuv.org/en/v1.x/misc.html?highlight=uv_os_getenv#c.uv_os_setenv
http://docs.libuv.org/en/v1.x/misc.html?highlight=uv_os_getenv#c.uv_os_unsetenv

Activity

  1. added
    good first issueIssues that are suitable for first-time contributors.
    osIssues and PRs related to the os subsystem.
    processIssues and PRs related to the process subsystem.
    c++Issues and PRs that require attention from people who are familiar with C++.
    on Apr 13, 2019
  2. joyeecheung commented on Apr 13, 2019

    @joyeecheung
    MemberAuthor

    Prior work: #14641

    It seems easier to refactor uv_os_setenv and uv_os_unsetenv, uv_os_getenv is trickier due to how the buffer allocation is handled - the caller needs to retry when the allocated buffer is not large enough.

  3. devasci commented on Apr 15, 2019

    @devasci
    Contributor

    Hi, It seems to be a good item for me as a first timer. I will work one this and will share the updates soon.

  4. devasci commented on Apr 19, 2019

    @devasci
    Contributor

    Modified as Joyee Cheung suggested and tested by following contributors guide.

    Created pull request: #27310

  5. 19 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++Issues and PRs that require attention from people who are familiar with C++.good first issueIssues that are suitable for first-time contributors.osIssues and PRs related to the os subsystem.processIssues and PRs related to the process subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions