summaryrefslogtreecommitdiff
path: root/CC/include_scan.py
diff options
context:
space:
mode:
Diffstat (limited to 'CC/include_scan.py')
-rwxr-xr-xCC/include_scan.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/CC/include_scan.py b/CC/include_scan.py
index 1efa528..e169ec5 100755
--- a/CC/include_scan.py
+++ b/CC/include_scan.py
@@ -33,15 +33,13 @@ import shutil
def include_scan(out_dir: str, cmd: list[str]):
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
- if not proc.stdout:
- proc.poll()
+ stdout, _ = proc.communicate()
+ if not stdout or proc.returncode != 0:
exit(proc.returncode)
- includes: set[str] = set()
- for line in proc.stdout:
- items = line.decode('utf-8').replace('\n', ' ')
- paths = {os.path.normpath(i) for i in items.split(' ')}
- includes |= {p for p in paths if p.startswith('include/')}
+ items = stdout.decode('utf-8').replace('\n', ' ')
+ paths = {os.path.normpath(i) for i in items.split(' ')}
+ includes = {p for p in paths if p.startswith('include/')}
for path in includes:
out_path = os.path.join(out_dir, path)
@@ -55,10 +53,6 @@ def include_scan(out_dir: str, cmd: list[str]):
print(e, file=sys.stderr)
exit(1)
- proc.poll()
- if proc.returncode != 0:
- exit(proc.returncode)
-
if __name__ == '__main__':
include_scan(out_dir=sys.argv[1], cmd=sys.argv[2:])