Closed zhaodiaoer closed 7 months ago
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.
Just pushed a fix after some tweaking - let me know if that works.
When using
expand.FuncEnviron
to generate runner and using this runner to run thefile
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 theEnviron
interface, but theEach
is no-op method, so when executingrunner.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.