Files
advent-of-code-2021/run_all.py
Pascal Lais fe738ad150
All checks were successful
continuous-integration/drone/push Build is passing
Use Popen to fix output order in drone
2021-12-05 14:46:46 +01:00

20 lines
577 B
Python

#!/usr/bin/python3
from os import listdir
from os.path import isdir, isfile
from subprocess import Popen, PIPE, CalledProcessError
for dir in [x for x in sorted(listdir('.')) if isdir(x)]:
file = dir + '/' + dir + '.py'
input = dir + '/input.txt'
if isfile(file) and isfile(input):
print(dir, ':', sep='')
with Popen(["python3", file], stdout=PIPE, bufsize=1, universal_newlines=True) as p:
for b in p.stdout:
print(b, end='')
if p.returncode != 0:
raise CalledProcessError(p.returncode, p.args)