Output errors / warnings on stderr instead of stdout (#6881)

This commit is contained in:
Brian King 2021-10-07 16:58:10 -05:00 committed by GitHub
parent 4c7a9c10d3
commit 9a4ca2764c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -23,15 +23,15 @@ static void Warn(const flatbuffers::FlatCompiler *flatc,
const std::string &warn, bool show_exe_name) {
(void)flatc;
if (show_exe_name) { printf("%s: ", g_program_name); }
printf("warning: %s\n", warn.c_str());
fprintf(stderr, "warning: %s\n", warn.c_str());
}
static void Error(const flatbuffers::FlatCompiler *flatc,
const std::string &err, bool usage, bool show_exe_name) {
if (show_exe_name) { printf("%s: ", g_program_name); }
printf("error: %s\n", err.c_str());
fprintf(stderr, "error: %s\n", err.c_str());
if (usage && flatc) {
printf("%s", flatc->GetUsageString(g_program_name).c_str());
fprintf(stderr, "%s", flatc->GetUsageString(g_program_name).c_str());
}
exit(1);
}