1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Close files before opening new ones (#53961)

This commit is contained in:
Matt Martz 2019-03-18 10:21:49 -05:00 committed by GitHub
parent 73e171fd94
commit 231f3e138a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -364,6 +364,14 @@ class CallbackModule(CallbackBase):
def _profile(self, obj=None):
prev_task = None
results = dict.fromkeys(self._features)
for dummy, f in self._files.items():
if f is None:
continue
try:
f.close()
except Exception:
pass
try:
for name, prof in self._profilers.items():
prof.running = False
@ -397,12 +405,6 @@ class CallbackModule(CallbackBase):
def v2_playbook_on_stats(self, stats):
self._profile()
for dummy, f in self._files.items():
try:
f.close()
except Exception:
pass
if not self._display_recap:
return