diff options
author | John Christopher Anderson <jchris@apache.org> | 2009-12-22 18:03:44 +0000 |
---|---|---|
committer | John Christopher Anderson <jchris@apache.org> | 2009-12-22 18:03:44 +0000 |
commit | ea3b1153e52ac1513da4d634eedefb05c261039c (patch) | |
tree | 858c5b3d81509bfe784b8d2d1252921cbf34aa54 /test/view_server/run_native_process.es | |
parent | 22c551bb103072826c0299265670d1483c753dde (diff) |
move query server to a design-doc based protocol, closes COUCHDB-589
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@893249 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/view_server/run_native_process.es')
-rwxr-xr-x | test/view_server/run_native_process.es | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/test/view_server/run_native_process.es b/test/view_server/run_native_process.es index dfdc423e..fcf16d75 100755 --- a/test/view_server/run_native_process.es +++ b/test/view_server/run_native_process.es @@ -15,7 +15,7 @@ read() -> case io:get_line('') of eof -> stop; - Data -> mochijson2:decode(Data) + Data -> couch_util:json_decode(Data) end. send(Data) when is_binary(Data) -> @@ -24,15 +24,19 @@ send(Data) when is_list(Data) -> io:format(Data ++ "\n", []). write(Data) -> - case (catch mochijson2:encode(Data)) of + % log("~p", [Data]), + case (catch couch_util:json_encode(Data)) of + % when testing, this is what prints your errors {json_encode, Error} -> write({[{<<"error">>, Error}]}); Json -> send(Json) end. -%log(Mesg) -> +% log(Mesg) -> % log(Mesg, []). -%log(Mesg, Params) -> +% log(Mesg, Params) -> % io:format(standard_error, Mesg, Params). +% jlog(Mesg) -> +% write([<<"log">>, list_to_binary(io_lib:format("~p",[Mesg]))]). loop(Pid) -> case read() of @@ -40,7 +44,7 @@ loop(Pid) -> Json -> case (catch couch_native_process:prompt(Pid, Json)) of {error, Reason} -> - ok = write({[{error, Reason}]}); + ok = write([error, Reason, Reason]); Resp -> ok = write(Resp), loop(Pid) |