interrogate: exit with nonzero status when failing to write -oc/od

Fixes #666
This commit is contained in:
rdb 2019-06-07 22:10:13 +02:00
parent 2f97b76b42
commit 3d6f35827a

View File

@ -574,6 +574,8 @@ main(int argc, char **argv) {
the_output_include = &output_include; the_output_include = &output_include;
} }
int status = 0;
// Now output all of the wrapper functions. // Now output all of the wrapper functions.
if (!output_code_filename.empty()) if (!output_code_filename.empty())
{ {
@ -595,6 +597,7 @@ main(int argc, char **argv) {
if (output_code.fail()) { if (output_code.fail()) {
nout << "Unable to write to " << output_code_filename << "\n"; nout << "Unable to write to " << output_code_filename << "\n";
status = -1;
} else { } else {
builder.write_code(output_code,the_output_include, def); builder.write_code(output_code,the_output_include, def);
} }
@ -609,13 +612,13 @@ main(int argc, char **argv) {
pofstream output_data; pofstream output_data;
output_data_filename.open_write(output_data); output_data_filename.open_write(output_data);
if (output_data.fail()) if (output_data.fail()) {
{
nout << "Unable to write to " << output_data_filename << "\n"; nout << "Unable to write to " << output_data_filename << "\n";
status = -1;
} else { } else {
InterrogateDatabase::get_ptr()->write(output_data, def); InterrogateDatabase::get_ptr()->write(output_data, def);
} }
} }
return (0); return status;
} }