Support passing environment variables to processes
See original GitHub issueUse 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.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Passing environment variables to a process - node.js
There are two ways to set the pass variables from your current shell a running program,. Either use the export built-in with syntax...
Read more >Is it possible to pass environment variables from child ...
No, it's not possible. Not without some kind of workaround. Environment variables can only be passed from parent to child (as part of ......
Read more >Setting environment variables in Linux for all processes
In Windows, one can simply define a "system variable" which becomes available across all processes in the OS. How does one do this...
Read more >How To Set Environment Variables
Environment variables in your system describe your environment. Learn how to set up environment variables in Linux, Windows, macOS, ...
Read more >Environment Variables & Attacks
Process can get environment variables one of two ways: • If a new process is created using fork() ... Passing environment variables when...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Works here 👍 :shipit:
I’m doing so too. And loving it!