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

Commit 51460f4

Browse files
authored
Merge pull request #258 from DiptoChakrabarty/kube_config
closes open file descriptors to prevent leaks
2 parents 298f21a + 95e2e85 commit 51460f4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

config/kube_config.py

+2-1
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)