Set an environment variable for the debugging port
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/b5ddad2d Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/b5ddad2d Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/b5ddad2d Branch: refs/heads/nodejs_couchdb Commit: b5ddad2d1704743e4dc8e852c7d5ef50983f6541 Parents: c616659 Author: Jason Smith (work) <j...@iriscouch.com> Authored: Sun Feb 3 14:34:09 2013 +0000 Committer: Jason Smith (work) <j...@iriscouch.com> Committed: Sun Feb 3 14:34:09 2013 +0000 ---------------------------------------------------------------------- src/couchdb/couch_query_servers.erl | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/b5ddad2d/src/couchdb/couch_query_servers.erl ---------------------------------------------------------------------- diff --git a/src/couchdb/couch_query_servers.erl b/src/couchdb/couch_query_servers.erl index e29f23b..b15122b 100644 --- a/src/couchdb/couch_query_servers.erl +++ b/src/couchdb/couch_query_servers.erl @@ -479,7 +479,14 @@ new_process(Langs, LangLimits, Lang) -> if (Lim == 0) or (Current < Lim) -> % Lim == 0 means no limit % we are below the limit for our language, make a new one case ets:lookup(Langs, Lang) of - [{Lang, Mod, Func, Arg}] -> + [{Lang, Mod, Func, Arg0}] -> + Arg = case {Lang, Arg0} of + {<<"javascript">>, [_OneElement]} -> + DebugPort = 5858 + random:uniform(1000), + EnvOpt = {env, [{"COUCHJS_DEBUG_PORT", integer_to_list(DebugPort)}]}, + Arg0 ++ [[], [EnvOpt]]; + _ -> Arg0 + end, {ok, Pid} = apply(Mod, Func, Arg), erlang:monitor(process, Pid), true = ets:insert(LangLimits, {Lang, Lim, Current+1}),