question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support passing environment variables to processes

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found