diff --git a/doctr/__main__.py b/doctr/__main__.py index 86bcbe93..b652dc4b 100644 --- a/doctr/__main__.py +++ b/doctr/__main__.py @@ -45,6 +45,10 @@ from . import __version__ +# Force all prints to flush to keep the output in order on Travis +builtin_print = print +print = lambda *args, **kwargs: builtin_print(*args, **{'flush': True, **kwargs}) + def make_parser_with_config_adder(parser, config): """factory function for a smarter parser: diff --git a/doctr/travis.py b/doctr/travis.py index 178032dc..4ae15eea 100644 --- a/doctr/travis.py +++ b/doctr/travis.py @@ -18,6 +18,10 @@ from .common import red, blue DOCTR_WORKING_BRANCH = '__doctr_working_branch' +# Force all prints to flush to keep the output in order on Travis +builtin_print = print +print = lambda *args, **kwargs: builtin_print(*args, **{'flush': True, **kwargs}) + def decrypt_file(file, key): """ Decrypts the file ``file``. @@ -148,6 +152,8 @@ def run(args, shell=False, exit=True): sys.stdout.flush() returncode = run_command_hiding_token(args, token, shell=shell) + sys.stdout.flush() + sys.stderr.flush() if exit and returncode != 0: sys.exit(red("%s failed: %s" % (command, returncode)))