You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
expand: FuncEnviron provided environment variables will not copy cross pipe #1043
When using expand.FuncEnviron to generate runner and using this runner to run the file type Node that contains any pipe operator symbol, it will cause environment variables to not transfer across pipes and be visible for all command statements.
That's because expand.FuncEnviron does implement the Environ interface, but the Each is no-op method, so when executing runner.Subshell() to get a new runner for one side command of pipe, environment variables will not be copied as expected.
It would be helpful to add comments to the expand.FuncEnviron function. This will prevent others from troubleshooting similar problems for a long time, like I did.
Activity
mvdan commentedon Nov 15, 2023
Thanks for spotting this - I agree it's a significant pitfall. I'd prefer to fix this over documenting the limitation, as it seems rather severe.
mvdan commentedon Nov 15, 2023
Just pushed a fix after some tweaking - let me know if that works.
interp: support subshells with FuncEnviron as Env