[Haskell-cafe] Help converting Perl to Haskell

Jason Dagit dagit at codersbase.com
Wed Oct 22 02:04:44 EDT 2008


On Tue, Oct 21, 2008 at 9:33 PM, Duncan Coutts
<duncan.coutts at worc.ox.ac.uk> wrote:
> On Tue, 2008-10-21 at 20:33 -0700, Jason Dagit wrote:
>
>> Correct me if I'm wrong, but if I want to make this work on windows I
>> can't use System.Posix, right?  If so, what is the portable way to set
>> environment variables?  I see[1] that getEnv exists in
>> System.Environment, but setEnv is in System.Posix.Env.  I looked in
>> System.Win32 and I didn't see anything that looked like it would
>> manipulate environment variables.  Will I have to use
>> System.Process.runProcess on Win32?  I'd like this to work on ghc 6.6
>> and System.Process looks new?
>
> Right. Typically you do not need to change the env vars for your own
> process, just to pass new ones to new processes and
> System.Process.runProcess lets you specify a new set of environment
> vars.

Thanks.  I just tried this out and it should do what I want.  I see
that I just fetch the current environment, append or update it and
then pass it to runProcess.

>
> As you can check, System.Process.runProcess has been around since ghc
> 6.6 (and before):

Thanks, it's really nice to have that unambiguously be in 6.6.

Jason


More information about the Haskell-Cafe mailing list