[torque-ls] Fix Json serialization

Stringification of Json wrongly used quotes for "true", "false" and
"null".

Drive-by: Manually flush std::cout when sending messages. This might
fix the server on windows.

R=tebbi@chromium.org

Bug: v8:8880
Change-Id: Ie499595a1b429514c5d8b1d3ece24f4690ece02e
Reviewed-on: https://chromium-review.googlesource.com/c/1498132
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59992}
This commit is contained in:
Simon Zünd 2019-03-04 07:47:14 +01:00 committed by Commit Bot
parent df1279bf85
commit 0edcb2239a
2 changed files with 3 additions and 3 deletions

View File

@ -24,10 +24,10 @@ void SerializeToString(std::stringstream& str, const JsonValue& value) {
str << StringLiteralQuote(value.ToString());
break;
case JsonValue::IS_NULL:
str << "\"null\"";
str << "null";
break;
case JsonValue::BOOL:
str << (value.ToBool() ? "\"true\"" : "\"false\"");
str << (value.ToBool() ? "true" : "false");
break;
case JsonValue::OBJECT: {
str << "{";

View File

@ -54,7 +54,7 @@ void WriteMessage(JsonValue& message) {
Logger::Log("[outgoing] ", content, "\n\n");
std::cout << kContentLength << content.size() << "\r\n\r\n";
std::cout << content;
std::cout << content << std::flush;
}
namespace {