Skip to content

Commit

Permalink
Flush before subprocess calls. Flush on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
jreichman committed Aug 25, 2023
1 parent d29e9cd commit 8bac96c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/dfbar/dfbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def process_docker_spec(spec, dockerfile=None, verbose=False,

logger.log_verbose('Build call args: %s' % call_args)

sys.stdout.flush()
proc = subprocess.run(call_args, shell=shell, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if proc.returncode != 0:
print(proc.stdout.decode('ascii'))
Expand Down Expand Up @@ -170,6 +171,7 @@ def process_docker_spec(spec, dockerfile=None, verbose=False,

logger.log_verbose('Run call args: %s' % call_args)

sys.stdout.flush()
return subprocess.run(call_args, shell=shell).returncode

return 0
Expand Down Expand Up @@ -313,9 +315,12 @@ def main():

def cli_entrypoint():
try:
sys.exit(main())
ret = main()
sys.stdout.flush()
sys.exit(ret)
except Exception as e:
print(e)
sys.stdout.flush()
sys.exit(1)

if __name__ == '__main__':
Expand Down

0 comments on commit 8bac96c

Please sign in to comment.