Gabriella439 / turtle

Shell programming, Haskell style

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`inproc` resetting environment variables

freuk opened this issue · comments

Some of the shell commands inherit environment variables (shell, proc), and some don't (inshell, inproc, and most others I have tried to use). Is this a problem, or should this be documented somewhere? I'd submit a PR, but I would like to be sure of the intended behavior first.

@freuk: That's not intended behavior. I had intended all of them to inherit environment variables and I didn't realize that some of them didn't

Okay. system does inherit the environment, but stream and streamWithErr don't, for instance. They actually erase the 'env' record field of CreateProcess, but I can't figure out why.

I'll try on the next weekend, it turns out I don't know the underlying libraries well enough to quickly suggest a patch at the moment.

I cannot reproduce the original problem, meaning that inproc appears to inherit environment variables. The way I reproduced this was:

$ cat ./foo
env | grep FOO

$ FOO=BAR cabal repl lib:turtle
...
*Turtle> :set -XOverloadedStrings
*Turtle> inproc "./foo" [] empty & stdout
FOO=BAR

Hi Gabriel, I was indeed wrong in my assessment. These do inherit the environment properly, nothing to see here. Sorry for the noise, frankly.

No apology necessary 🙂