mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-29 19:07:08 +00:00
Log error instead of asserting if writing file fails.
Also remove some unused code.
This commit is contained in:
parent
08e856b85a
commit
327958dbe0
11
src/utils.cc
11
src/utils.cc
@ -456,15 +456,14 @@ void UpdateTestExpectation(const std::string& filename,
|
|||||||
of.close();
|
of.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fail(const std::string& message) {
|
|
||||||
LOG_S(FATAL) << "Fatal error: " << message;
|
|
||||||
std::exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WriteToFile(const std::string& filename, const std::string& content) {
|
void WriteToFile(const std::string& filename, const std::string& content) {
|
||||||
std::ofstream file(filename,
|
std::ofstream file(filename,
|
||||||
std::ios::out | std::ios::trunc | std::ios::binary);
|
std::ios::out | std::ios::trunc | std::ios::binary);
|
||||||
assert(file.good());
|
if (!file.good()) {
|
||||||
|
LOG_S(ERROR) << "Cannot write to " << filename;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
file << content;
|
file << content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,8 +99,6 @@ void UpdateTestExpectation(const std::string& filename,
|
|||||||
const std::string& expectation,
|
const std::string& expectation,
|
||||||
const std::string& actual);
|
const std::string& actual);
|
||||||
|
|
||||||
void Fail(const std::string& message);
|
|
||||||
|
|
||||||
void WriteToFile(const std::string& filename, const std::string& content);
|
void WriteToFile(const std::string& filename, const std::string& content);
|
||||||
|
|
||||||
// note: this implementation does not disable this overload for array types
|
// note: this implementation does not disable this overload for array types
|
||||||
|
Loading…
Reference in New Issue
Block a user