Fixed the way we restore stderr after temporarily supressing it.

Now we don't mess with `sys.stderr` we just use `os.dup2` to restore it
from the copy.
This commit is contained in:
Salvador E. Tropea 2021-02-10 14:10:10 -03:00
parent 67cee9988a
commit 12bfa88677
1 changed files with 1 additions and 2 deletions

View File

@ -7,7 +7,6 @@
import re
import os
import sys
from contextlib import contextmanager
@ -210,4 +209,4 @@ def hide_stderr():
os.dup2(devnull, 2)
os.close(devnull)
yield
sys.stderr = os.fdopen(newstderr, 'w')
os.dup2(newstderr, 2)