[plt-scheme] set environment variables in subprocess

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Jan 13 20:32:50 EST 2010

At the OS level, execve() or CreateProcess() lets you provide
environment variables for the new process, instead of just using the
current process's settings. So, we could extend `subprocess' to avoid
`putenv' collisions, but that support is not currently available.

At Wed, 13 Jan 2010 19:12:08 -0600, Robby Findler wrote:
> I guess you'd have to serialize the actual creation of the processes,
> or use yet another process to first set its own variables than exec
> the cgi program.
> 
> Robby
> 
> 2010/1/13 YC <yinso.chen at gmail.com>:
> >
> > On Wed, Jan 13, 2010 at 4:00 PM, David Brown <plt at davidb.org> wrote:
> >>
> >> On Wed, Jan 13, 2010 at 03:07:59PM -0800, YC wrote:
> >>
> >>> is there a way to set the environment variables for the subprocess?  
> Looking
> >>> at http://docs.plt-scheme.org/reference/subprocess.html it was not clear 
> how
> >>> this can be accomplished.
> >>
> >> The 'subprocess' call calls execv on Unix/Linux, so you would have to
> >> set it in the current process before the subprocess is created, which
> >> you could do with 'putenv'.
> >
> > Thanks Jay & Dave.  setenv & putenv modifies the current process's 
> environment variable, so it sounds like if you want to spawn multiple 
> subprocesses in multi-threaded fashion you will have some sort of contention 
> if you are setting more than one environment variables. The example I am 
> thinking about is spawning CGI processes, where the headers are written into 
> the environment variables.
> >
> > Are there other ways or is my concern moot?  Thanks,
> > yc
> >
> >
> >
> >
> >
> > _________________________________________________
> >  For list-related administrative tasks:
> >  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> >
> >
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme


Posted on the users mailing list.