On Sun, Dec 11, 2005 at 06:52:32PM -0500, J. Milgram wrote:
> Is it possible for a child process to set an environment variable in the
> parent process that launched it?

Nope, at least not through any of the standard programmatic interfaces
that the OS provides.

If you want to get Extremely Tricky I suppose you could reach into
the parent process's memory space (via /proc or similar) and scribble
new environment information into it...but this would be risky and
highly non-portable.

If the goal is to pass info from the child process to the parent, it's
probably much simpler/cleaner to just have them talk over a pipe.  If
the child and the parent are written in something that makes setting up
a pipe difficult, then the expedient of having the parent read a file written
by child -- which I know is clunky -- might get the job done.

Reply via email to