Skip to content

Commit

Permalink
Fix output read from the include-what-you-use tool (#31920)
Browse files Browse the repository at this point in the history
Reading one line and checking whether process is alive might lead
to premature read termination in case when subprocess outputs lots
of lines and terminates right away.
  • Loading branch information
arkq authored and pull[bot] committed Feb 25, 2024
1 parent 45ca2e4 commit d8dd0d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/helpers/iwyu-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ def main(compile_commands_glob, scanning_destination, mapping_file_dir,
logging.info("============== IWYU output start ================")

logger = logging.info
while status.poll() is None:
line = status.stdout.readline().rstrip()
for line in status.stdout:
line = line.rstrip()

if re.match(r"^warning:.*$", line):
logger = logging.warning
Expand Down
5 changes: 5 additions & 0 deletions scripts/helpers/platforms/iwyu.imp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@
## lib/*
{ include: [ '"lib/core/CHIPError.h"', private, '<lib/core/CHIPError.h>', public ] },
{ include: [ '"lib/dnssd/ServiceNaming.h"', private, '<lib/dnssd/platform/Dnssd.h>', public ] },

## lib/support/logging/*
{ include: [ '"lib/support/logging/BinaryLogging.h"', private, '<lib/support/logging/CHIPLogging.h>', public ] },
{ include: [ '"lib/support/logging/CHIPLogging.h"', private, '<lib/support/logging/CHIPLogging.h>', public ] },
{ include: [ '"lib/support/logging/Constants.h"', private, '<lib/support/logging/CHIPLogging.h>', public ] },
{ include: [ '"lib/support/logging/TextOnlyLogging.h"', private, '<lib/support/logging/CHIPLogging.h>', public ] },

## platform/*
{ include: [ '"platform/NetworkCommissioning.h"', private, '<platform/NetworkCommissioning.h>', public ] },
Expand Down

0 comments on commit d8dd0d8

Please sign in to comment.