Skip to content

Commit eb18d11

Browse files
authored
main.cpp: added option -f to fail on output error (danmar#436)
1 parent 6cc4f53 commit eb18d11

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ int main(int argc, char **argv)
1818
bool error = false;
1919
const char *filename = nullptr;
2020
bool use_istream = false;
21+
bool fail_on_error = false;
2122

2223
// Settings..
2324
simplecpp::DUI dui;
@@ -70,6 +71,10 @@ int main(int argc, char **argv)
7071
error_only = true;
7172
found = true;
7273
break;
74+
case 'f':
75+
fail_on_error = true;
76+
found = true;
77+
break;
7378
}
7479
if (!found) {
7580
std::cout << "error: option '" << arg << "' is unknown." << std::endl;
@@ -172,5 +177,8 @@ int main(int argc, char **argv)
172177
}
173178
}
174179

180+
if (fail_on_error && !outputList.empty())
181+
return 1;
182+
175183
return 0;
176184
}

0 commit comments

Comments
 (0)