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

Support passing environment variables to processes #174

Closed
damianh opened this issue Dec 10, 2019 · 5 comments · Fixed by #175
Closed

Support passing environment variables to processes #174

damianh opened this issue Dec 10, 2019 · 5 comments · Fixed by #175
Labels
enhancement New feature or request
Milestone

Comments

@damianh
Copy link
Contributor

damianh commented Dec 10, 2019

Use case(s)

Some of our tooling (basically around yarn / npm) leverages environment variables instead of arguments and some scenarios it not possible to pass args via scripts nested in package.json. (How does software even work?)

Description

Since simple-exec is a wrapper around ProcessStartInfo which already supports EnviromentVariables and since UseShellExecute is false, it should allow the caller to optionally modify before executing:

public static void Run(string name, ..snip... , Action<IDictionary<string, string>> configEnvironmentVariables = null);

Example usage:

Run("foo", ...snip..., env => env["bar"] = "baz");

Alternatives

This is nasty yo

Environment.SetEnvironmentVariable("bar", "baz"); 
RunCmd("yarn", "somescript");
Environment.SetEnvironmentVariable("", ""); 

Additional context

None.

@damianh damianh added the enhancement New feature or request label Dec 10, 2019
@adamralph
Copy link
Owner

I like it! And I could use it to simplify the MinVer package tests.

@adamralph
Copy link
Owner

@damianh I've released this in 6.2.0-rc.1. Can you take it for a spin?

@damianh
Copy link
Contributor Author

damianh commented Dec 15, 2019

I will

@damianh
Copy link
Contributor Author

damianh commented Dec 17, 2019

Works here 👍 :shipit:

@adamralph adamralph mentioned this issue Dec 21, 2019
10 tasks
@adamralph adamralph changed the title Support passing environment vars to processes Support passing environment variables to processes Oct 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants