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:
Thomas Woerner
2025-07-14 15:52:36 +02:00
committed by GitHub
2 changed files with 6 additions and 2 deletions

View File

@@ -213,11 +213,13 @@ def setup_logging():
@contextlib_contextmanager
def redirect_stdout(stream):
old_stdout = sys.stdout
sys.stdout = stream
try:
yield stream
finally:
sys.stdout = sys.__stdout__
sys.stdout = old_stdout
class AnsibleModuleLog():

View File

@@ -241,11 +241,13 @@ def setup_logging():
@contextlib_contextmanager
def redirect_stdout(stream):
old_stdout = sys.stdout
sys.stdout = stream
try:
yield stream
finally:
sys.stdout = sys.__stdout__
sys.stdout = old_stdout
class AnsibleModuleLog():