forked from OSchip/llvm-project
[clangd] Harden test against sed implementations that strip \r.
Also clean up logging and don't print \0. llvm-svn: 294294
This commit is contained in:
parent
258d9a528e
commit
d588b0f525
|
@ -68,18 +68,17 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
// Now read the JSON. Insert a trailing null byte as required by the YAML
|
// Now read the JSON. Insert a trailing null byte as required by the YAML
|
||||||
// parser.
|
// parser.
|
||||||
std::vector<char> JSON(Len + 1);
|
std::vector<char> JSON(Len + 1, '\0');
|
||||||
std::cin.read(JSON.data(), Len);
|
std::cin.read(JSON.data(), Len);
|
||||||
|
|
||||||
if (Len > 0) {
|
if (Len > 0) {
|
||||||
|
llvm::StringRef JSONRef(JSON.data(), Len);
|
||||||
// Log the message.
|
// Log the message.
|
||||||
Logs << "<-- ";
|
Logs << "<-- " << JSONRef << '\n';
|
||||||
Logs.write(JSON.data(), JSON.size());
|
|
||||||
Logs << '\n';
|
|
||||||
Logs.flush();
|
Logs.flush();
|
||||||
|
|
||||||
// Finally, execute the action for this JSON message.
|
// Finally, execute the action for this JSON message.
|
||||||
if (!Dispatcher.call(llvm::StringRef(JSON.data(), JSON.size() - 1)))
|
if (!Dispatcher.call(JSONRef))
|
||||||
Logs << "JSON dispatch failed!\n";
|
Logs << "JSON dispatch failed!\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# RUN: sed -e '/^#/d' %s | clangd | FileCheck %s
|
# RUN: sed -e '/^#/d' -e 's/\r*$/\r/' %s | clangd | FileCheck %s
|
||||||
# It is absolutely vital that this file has CRLF line endings.
|
|
||||||
#
|
#
|
||||||
Content-Length: 125
|
Content-Length: 125
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue