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