mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-08-02 12:54:52 +00:00
Merge pull request #1329 from Nihlus/fix-stdout-caching
Cache sys.stdout instead of assuming it is equal to sys.__stdout__
This commit is contained in:
@@ -213,11 +213,13 @@ def setup_logging():
|
|||||||
|
|
||||||
@contextlib_contextmanager
|
@contextlib_contextmanager
|
||||||
def redirect_stdout(stream):
|
def redirect_stdout(stream):
|
||||||
|
old_stdout = sys.stdout
|
||||||
|
|
||||||
sys.stdout = stream
|
sys.stdout = stream
|
||||||
try:
|
try:
|
||||||
yield stream
|
yield stream
|
||||||
finally:
|
finally:
|
||||||
sys.stdout = sys.__stdout__
|
sys.stdout = old_stdout
|
||||||
|
|
||||||
|
|
||||||
class AnsibleModuleLog():
|
class AnsibleModuleLog():
|
||||||
|
|||||||
@@ -241,11 +241,13 @@ def setup_logging():
|
|||||||
|
|
||||||
@contextlib_contextmanager
|
@contextlib_contextmanager
|
||||||
def redirect_stdout(stream):
|
def redirect_stdout(stream):
|
||||||
|
old_stdout = sys.stdout
|
||||||
|
|
||||||
sys.stdout = stream
|
sys.stdout = stream
|
||||||
try:
|
try:
|
||||||
yield stream
|
yield stream
|
||||||
finally:
|
finally:
|
||||||
sys.stdout = sys.__stdout__
|
sys.stdout = old_stdout
|
||||||
|
|
||||||
|
|
||||||
class AnsibleModuleLog():
|
class AnsibleModuleLog():
|
||||||
|
|||||||
Reference in New Issue
Block a user