mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 15:45:08 +00:00
Ignore stdout SIGPIPE
This commit is contained in:
parent
d099afb0cc
commit
865d567c10
@ -21,7 +21,6 @@
|
||||
#include "semantic_highlight_symbol_cache.h"
|
||||
#include "serializer.h"
|
||||
#include "serializers/json.h"
|
||||
#include "standard_includes.h"
|
||||
#include "test.h"
|
||||
#include "threaded_queue.h"
|
||||
#include "timer.h"
|
||||
@ -37,7 +36,6 @@
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
@ -336,16 +334,20 @@ void LaunchStdoutThread(std::unordered_map<IpcId, Timer>* request_times,
|
||||
}
|
||||
|
||||
if (g_log_stdin_stdout_to_stderr) {
|
||||
std::ostringstream sstream;
|
||||
sstream << "[COUT] |";
|
||||
sstream << message.content;
|
||||
sstream << "|\n";
|
||||
std::cerr << sstream.str();
|
||||
std::cerr.flush();
|
||||
try {
|
||||
std::cerr << "[COUT] |" << message.content << "|\n";
|
||||
std::cerr.flush();
|
||||
} catch (std::ios_base::failure&) {
|
||||
// TODO Ignore for now
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << message.content;
|
||||
std::cout.flush();
|
||||
try {
|
||||
std::cout << message.content;
|
||||
std::cout.flush();
|
||||
} catch (std::ios_base::failure&) {
|
||||
// TODO Ignore for now
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -40,8 +40,8 @@ int MyersDiff(const char *a, int la, const char *b, int lb, int threshold) {
|
||||
for (; a < ea && b < eb && *a == *b; a++, b++) {}
|
||||
// Strip suffix
|
||||
for (; a < ea && b < eb && ea[-1] == eb[-1]; ea--, eb--) {}
|
||||
la = ea - a;
|
||||
lb = eb - b;
|
||||
la = int(ea - a);
|
||||
lb = int(eb - b);
|
||||
|
||||
int* v = v_static + lb;
|
||||
v[1] = 0;
|
||||
@ -113,6 +113,8 @@ void WorkingFile::ComputeLineMapping() {
|
||||
from_index.resize(index_lines.size());
|
||||
from_buffer.resize(all_buffer_lines.size());
|
||||
hash_to_unique.reserve(std::max(from_index.size(), from_buffer.size()));
|
||||
|
||||
// For index line i, set from_index[i] to -1 if line i is duplicated.
|
||||
int i = 0;
|
||||
for (auto& line : index_lines) {
|
||||
std::string trimmed = Trim(line);
|
||||
@ -129,6 +131,7 @@ void WorkingFile::ComputeLineMapping() {
|
||||
index_hashes[i++] = h;
|
||||
}
|
||||
|
||||
// For buffer line i, set from_buffer[i] to -1 if line i is duplicated.
|
||||
i = 0;
|
||||
hash_to_unique.clear();
|
||||
for (auto& line : all_buffer_lines) {
|
||||
@ -145,7 +148,8 @@ void WorkingFile::ComputeLineMapping() {
|
||||
buffer_hashes[i++] = h;
|
||||
}
|
||||
|
||||
// Align unique lines.
|
||||
// Align unique lines of index and buffer by setting from_index[i] and
|
||||
// from_buffer[j] pointing to each other.
|
||||
i = 0;
|
||||
for (auto h : index_hashes) {
|
||||
if (from_index[i] >= 0) {
|
||||
@ -160,7 +164,7 @@ void WorkingFile::ComputeLineMapping() {
|
||||
i++;
|
||||
}
|
||||
|
||||
// Extending upwards and downwards.
|
||||
// Starting at unique lines, extend upwards and downwards.
|
||||
for (i = 0; i < (int)index_hashes.size() - 1; i++) {
|
||||
int j = from_index[i];
|
||||
if (0 <= j && j + 1 < buffer_hashes.size() &&
|
||||
|
Loading…
Reference in New Issue
Block a user