Skip to content

Commit

Permalink
Don't print error found in grep regex twice.
Browse files Browse the repository at this point in the history
Unless switched off, the re2 library logs a regex parse error.
  • Loading branch information
hzeller committed Jun 29, 2024
1 parent 846c066 commit 6b04c7b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bant/frontend/parsed-project.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,9 @@ void PrintProject(Session &session, const BazelPattern &pattern,

std::unique_ptr<RE2> regex;
if (!flags.grep_regex.empty()) {
// TODO: pass options to not log error
regex = std::make_unique<RE2>(flags.grep_regex);
RE2::Options options;
options.set_log_errors(false); // We print them ourselves
regex = std::make_unique<RE2>(flags.grep_regex, options);
if (!regex->ok()) {
// This really needs the session passed in so that we can reach the
// correct error stream.
Expand Down

0 comments on commit 6b04c7b

Please sign in to comment.