-
Notifications
You must be signed in to change notification settings - Fork 101
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
Add rcutils_set_env function #250
Conversation
This change adds a simple function for setting or un-setting an environment variable for the process. The existing environment variable functions in rcutils are under a header called `get_env.h`. It might be good to deprecate that header and move the functionality to the more generically-named `env.h`. Signed-off-by: Scott K Logan <logans@cottsay.net>
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, just check the env vars in the CMake
Yes, I'd be all for that. |
Signed-off-by: Scott K Logan <logans@cottsay.net>
It's too late to deprecate get_env.h in Foxy, but we can at least make the new header compatible in Foxy. Signed-off-by: Scott K Logan <logans@cottsay.net>
It's too late to deprecate get_env.h in Foxy, but we can at least make the new header compatible in Foxy. We can deprecate I added |
What is the reason to add this function at all? What is it needed for? |
I need to modify the environment for some feature testing in another package, where changing the environment for the entire test isn't desirable. This change clearly demonstrates that there isn't a foolproof cross-platform solution for doing it. If I'm going to do the work to create that mechanism and the accompanying tests, I thought it best to put it somewhere others can use it, especially because there are already some other environment functions to accompany it. |
I had another thought while reading the MSDN docs: Since you can't create an empty environment variable on Windows (setting it to |
I don't think prevent users on Linux to do what is possible on that platform is a good idea. I would rather document the difference in the docblock. |
Perfectly acceptable to me. Thanks for the feedback. |
Signed-off-by: Scott K Logan <logans@cottsay.net>
*sigh* Signed-off-by: Scott K Logan <logans@cottsay.net>
Done in 4ba9470 |
Signed-off-by: Scott K Logan <logans@cottsay.net>
Signed-off-by: Scott K Logan <logans@cottsay.net>
Signed-off-by: Scott K Logan <logans@cottsay.net>
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,
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.
The code looks good to me.
Are you intending to land this for Foxy, or can we defer this to after that?
It's a well-reviewed and tested addition to the API, and I'd like to use it in some tests in a downstream package, so it would be nice to land in Foxy. This package hasn't bumped to 1.0.0 yet, so I think there is another release that needs to happen anyway. Sound okay, @jacobperron? |
@cottsay I think since this is an addition (not modifying existing API), it's fine to land it for Foxy. |
Grazie! |
This change adds a simple function for setting or un-setting an environment variable for the process.
The existing environment variable functions in rcutils are under a header called
get_env.h
. It might be good to deprecate that header and move the functionality to the more generically-namedenv.h
. I'd love to hear feedback on that.If we decide to keep a separate
get_env.h
header moving forward, I should probably rename this one toset_env.h
.