Skip to content

Commit

Permalink
add safety wrapper around sys.stdout assignment
Browse files Browse the repository at this point in the history
See #723 for bug details
  • Loading branch information
tonybaloney committed Jan 4, 2018
1 parent 33b3fe8 commit 69e05ac
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tox/venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,11 @@ def run_install_command(self, packages, action, options=()):

old_stdout = sys.stdout
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
self._pcall(argv, cwd=self.envconfig.config.toxinidir, action=action,
redirect=self.session.report.verbosity < 2)
sys.stdout = old_stdout
try:
self._pcall(argv, cwd=self.envconfig.config.toxinidir,
action=action, redirect=self.session.report.verbosity < 2)
finally:
sys.stdout = old_stdout

def _install(self, deps, extraopts=None, action=None):
if not deps:
Expand Down

0 comments on commit 69e05ac

Please sign in to comment.