Hi Jason, What is the use case? It's about sharing CouchDB's local environ variables with os_daemons? Like:
FOO="bar" couchdb -b and FOO will be available for os_daemons? -- ,,,^..^,,, On Tue, Aug 6, 2013 at 1:57 PM, <[email protected]> wrote: > Updated Branches: > refs/heads/master 91b84219f -> a653e8d0f > > > Support providing environment variables to os_daemon subprocesses > > > Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo > Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/a653e8d0 > Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/a653e8d0 > Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/a653e8d0 > > Branch: refs/heads/master > Commit: a653e8d0fcf0e8560af99b549c4ab9ed42a924e1 > Parents: 91b8421 > Author: Jason Smith (work) <[email protected]> > Authored: Tue Aug 6 09:56:21 2013 +0000 > Committer: Jason Smith (work) <[email protected]> > Committed: Tue Aug 6 09:56:46 2013 +0000 > > ---------------------------------------------------------------------- > src/couchdb/couch_os_daemons.erl | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > ---------------------------------------------------------------------- > > > http://git-wip-us.apache.org/repos/asf/couchdb/blob/a653e8d0/src/couchdb/couch_os_daemons.erl > ---------------------------------------------------------------------- > diff --git a/src/couchdb/couch_os_daemons.erl > b/src/couchdb/couch_os_daemons.erl > index 9a912c4..cac031a 100644 > --- a/src/couchdb/couch_os_daemons.erl > +++ b/src/couchdb/couch_os_daemons.erl > @@ -193,9 +193,19 @@ code_change(_OldVsn, State, _Extra) -> > % > > start_port(Command) -> > + start_port(Command, []). > + > +start_port(Command, EnvPairs) -> > PrivDir = couch_util:priv_dir(), > Spawnkiller = filename:join(PrivDir, "couchspawnkillable"), > - Port = open_port({spawn, Spawnkiller ++ " " ++ Command}, ?PORT_OPTIONS), > + Opts = case lists:keytake(env, 1, ?PORT_OPTIONS) of > + false -> > + ?PORT_OPTIONS ++ [ {env,EnvPairs} ]; > + {value, {env,OldPairs}, SubOpts} -> > + AllPairs = lists:keymerge(1, EnvPairs, OldPairs), > + SubOpts ++ [ {env,AllPairs} ] > + end, > + Port = open_port({spawn, Spawnkiller ++ " " ++ Command}, Opts), > {ok, Port}. > > >
