Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flush stdout everywhere on Travis to avoid out-of-order output #323

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doctr/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
6 changes: 6 additions & 0 deletions doctr/travis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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``.
Expand Down Expand Up @@ -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)))
Expand Down