Skip to content

Commit bc4fda2

Browse files
committed
use Popen context manager for periodic update process (#2472)
1 parent 119c63e commit bc4fda2

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

docs/changelog/2472.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use Popen context manager for periodic update process to prevent ResourceWarning due to unclosed files

src/virtualenv/seed/wheels/periodic_update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def trigger_update(distribution, for_py_version, wheel, search_dirs, app_data, e
220220
kwargs = {"stdout": pipe, "stderr": pipe}
221221
if not debug and sys.platform == "win32":
222222
kwargs["creationflags"] = CREATE_NO_WINDOW
223-
process = Popen(cmd, **kwargs) # noqa: S603
223+
process = Popen(cmd, close_fds=True, **kwargs) # noqa: S603
224224
logging.info(
225225
"triggered periodic upgrade of %s%s (for python %s) via background process having PID %d",
226226
distribution,

0 commit comments

Comments
 (0)