couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject git commit: updated refs/heads/master to a653e8d
Date Tue, 06 Aug 2013 09:57:11 GMT
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) <jhs@apache.org>
Authored: Tue Aug 6 09:56:21 2013 +0000
Committer: Jason Smith (work) <jhs@apache.org>
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}.
 
 


Mime
View raw message