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

Fix the way environment variable is passed to ejson #759

Merged
merged 1 commit into from
Oct 21, 2020

Conversation

casperisfine
Copy link
Contributor

We just noticed this with @DazWorrall. In our environment EJSON_KEYDIR is set, and the way this code works right now doesn't allow to override existing env:

>> out, err, st = Open3.capture3({ 'EJSON_KEYDIR' => 'foo' }, "EJSON_KEYDIR=bar echo $EJSON_KEYDIR")
=> ["foo\n", "", #<Process::Status: pid 11963 exit 0>]

It's much better to pass the env as a hash, and the command arguments as variadic arguments anyway, as it avoid having to spawn a shell to parse the command.

Copy link
Contributor

@timothysmith0609 timothysmith0609 left a comment

Choose a reason for hiding this comment

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

🚢

Copy link
Contributor

@RyanBrushett RyanBrushett left a comment

Choose a reason for hiding this comment

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

@timothysmith0609 timothysmith0609 merged commit e92ba1c into master Oct 21, 2020
@timothysmith0609 timothysmith0609 deleted the fix-ejson-env branch October 21, 2020 13:25
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.

4 participants