[erlang-questions] erlexec and its environment
Bengt Kleberg
bengt.kleberg@REDACTED
Tue May 7 10:55:21 CEST 2013
Greetings,
There are some Erlang functions that have {env, [...]} argument. Ex:
erlang:open_port/2.
I think it would be good to have the same syntax ("a list of tuples
{Name, Val}, where Name is the name of an environment variable, and Val
is the value it is to have in the spawned port process." and the same
semantics for exec:run_link/2's {env, [...]}.
bengt
On Tue, 2013-05-07 at 10:34 +0200, David Welton wrote:
> Hi,
>
> We're doing some work to fix up a few things we perceive as
> deficiencies in erlexec, and thought about asking for a community
> opinion.
>
> Currently, this:
>
> exec:run_link("exec /tmp/print_env.sh", [])
>
> Launches the child process with no environment, which was quite a
> surprise to us - the default on Unix systems is to have child
> processes inherit the parent process' environment. We're hacking the
> system so that it'll behave like we expect.
>
> When an environment is specified, we were thinking to use that to say
> "ok, clear out the environment and don't inherit it":
>
> exec:run_link("/tmp/print_env.sh", [{env, ["VIVA=ERLANG"]}])
>
> So that if you really needed to pass it in, you could do:
>
> exec:run_link("/tmp/print_env.sh", [{env, os:getenv() ++ ["VIVA=ERLANG"]}])
>
> Thoughts?
> --
> David N. Welton
>
> http://www.welton.it/davidw/
>
> http://www.dedasys.com/
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list