Use Popen to fix output order in drone
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
11
run_all.py
11
run_all.py
@@ -2,13 +2,18 @@
|
|||||||
|
|
||||||
from os import listdir
|
from os import listdir
|
||||||
from os.path import isdir, isfile
|
from os.path import isdir, isfile
|
||||||
from subprocess import run
|
from subprocess import Popen, PIPE, CalledProcessError
|
||||||
|
|
||||||
|
|
||||||
for dir in [x for x in sorted(listdir('.')) if isdir(x)]:
|
for dir in [x for x in sorted(listdir('.')) if isdir(x)]:
|
||||||
file = dir + '/' + dir + '.py'
|
file = dir + '/' + dir + '.py'
|
||||||
input = dir + '/input.txt'
|
input = dir + '/input.txt'
|
||||||
if isfile(file) and isfile(input):
|
if isfile(file) and isfile(input):
|
||||||
print(dir, 'result:')
|
print(dir, ':', sep='')
|
||||||
run(["python3", file])
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user