Is it possible for a java.lang.Process to inherit the environement variables from another java.lang.

Posted by Eric Leung on Stack Overflow See other posts from Stack Overflow or by Eric Leung
Published on 2010-03-26T21:04:40Z Indexed on 2010/03/27 1:13 UTC
Read the original article Hit count: 366

Filed under:
|

I am trying to use groovy to do shell scripting on unix, but I am not having any luck having one process retain the environment variables changed by another process. For example,

    def p1 = ["bash", "-c", "source /some/setEnv.sh"].execute()

Now, I would like a second process, p2, to inherit the environment variables that was set in p1. How can I do this? I don't see anything in java.lang.Process or its groovy extension that would spit out the environment variables after the process has executed.

© Stack Overflow or respective owner

Related posts about groovy

Related posts about java