[ox/std] Make oxErr not automatically print new line to stderr

This commit is contained in:
Gary Talent 2021-07-17 01:26:05 -05:00
parent efe61bab6f
commit 5c28cef726
2 changed files with 2 additions and 2 deletions

View File

@ -52,7 +52,7 @@ void printStackTrace([[maybe_unused]]unsigned shave) noexcept {
#if defined(OX_USE_STDLIB) && __has_include(<unistd.h>)
Vector<void*> frames(1000);
frames.resize(static_cast<std::size_t>(backtrace(frames.data(), frames.size())));
if (frames.size() > shave) {
if (frames.size() - shave > 2) {
const auto symbols = backtrace_symbols(frames.data() + shave, frames.size() - shave);
const auto symbolicatedStacktrace = symbolicate(bit_cast<const char**>(frames.data() + shave), frames.size() - shave, "\t");
free(symbols);

View File

@ -34,7 +34,7 @@ void oxTraceHook([[maybe_unused]] const char *file, [[maybe_unused]] int line,
} else if (ox_strcmp(ch, "stdout") == 0) {
std::cout << msg;
} else if (ox_strcmp(ch, "stderr") == 0) {
std::cerr << msg << '\n';
std::cerr << msg;
} else if (ox_strcmp(ch, "error") == 0) {
std::cerr << "\033[31;1;1mERROR:\033[0m (" << file << ':' << line << "): " << msg << '\n';
}