Skip to content
This repository was archived by the owner on Mar 13, 2022. It is now read-only.

Commit 95e2e85

Browse files
closes open file descriptors to prevent leaks
1 parent 21f1d7f commit 95e2e85

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

config/kube_config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ def _create_temp_file_with_content(content, temp_file_path=None):
7070
return _temp_files[content_key]
7171
if temp_file_path and not os.path.isdir(temp_file_path):
7272
os.makedirs(name=temp_file_path)
73-
_, name = tempfile.mkstemp(dir=temp_file_path)
73+
fd, name = tempfile.mkstemp(dir=temp_file_path)
74+
os.close(fd)
7475
_temp_files[content_key] = name
7576
with open(name, 'wb') as fd:
7677
fd.write(content.encode() if isinstance(content, str) else content)

0 commit comments

Comments
 (0)