Skip to content

Feature/add env vars before running#16

Merged
sagiegurari merged 3 commits intosagiegurari:masterfrom
kenr:feature/add-env-vars-before-running
May 20, 2021
Merged

Feature/add env vars before running#16
sagiegurari merged 3 commits intosagiegurari:masterfrom
kenr:feature/add-env-vars-before-running

Conversation

@kenr
Copy link
Copy Markdown
Contributor

@kenr kenr commented May 19, 2021

  • Add support for adding environment variables before running script

@sagiegurari
Copy link
Copy Markdown
Owner

@kenr thanks a lot for the PR.
However, are you sure about this implementation? the issue is that you are changing the parent env and not the child process.
ya the child process will get the same env, meaning it will also have it, but it will impact the parent process which feels a bit unexpected.
most child process apis have an ability to provide a new env and rust isn't different here.
for example you can do:

Command::new("ls")
        .env("PATH", "/bin")
        .spawn()
        .expect("ls command failed to start");

that way, only the child process will have those env vars and parent process is not affected at all.
wdyt?

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Merging #16 (642c049) into master (a7bce2b) will increase coverage by 1.26%.
The diff coverage is 100.00%.

❗ Current head 642c049 differs from pull request most recent head d6a122e. Consider uploading reports for the commit d6a122e to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master      #16      +/-   ##
==========================================
+ Coverage   92.40%   93.67%   +1.26%     
==========================================
  Files           6        6              
  Lines         395      411      +16     
==========================================
+ Hits          365      385      +20     
+ Misses         30       26       -4     
Impacted Files Coverage Δ
src/runner.rs 86.04% <100.00%> (+1.24%) ⬆️
src/runner_test.rs 100.00% <100.00%> (+1.03%) ⬆️
src/types.rs 65.21% <100.00%> (+1.58%) ⬆️
src/lib_test.rs 100.00% <0.00%> (+3.57%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a7bce2b...d6a122e. Read the comment docs.

@kenr
Copy link
Copy Markdown
Contributor Author

kenr commented May 20, 2021

@sagiegurari I agree with you, the parent should not be polluted with the environment variables in options.
I've updated the PR with a fix and test covering this.

@sagiegurari
Copy link
Copy Markdown
Owner

excellent work!!! thanks a lot.

@sagiegurari sagiegurari merged commit 05b5847 into sagiegurari:master May 20, 2021
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