1212from itertools import groupby
1313from pathlib import Path
1414from shutil import copy2
15- from subprocess import PIPE , Popen
15+ from subprocess import DEVNULL , Popen
1616from textwrap import dedent
1717from threading import Thread
1818from urllib .error import URLError
@@ -216,7 +216,7 @@ def trigger_update(distribution, for_py_version, wheel, search_dirs, app_data, e
216216 .format (distribution , for_py_version , wheel_path , str (app_data ), [str (p ) for p in search_dirs ], periodic ),
217217 ]
218218 debug = env .get ("_VIRTUALENV_PERIODIC_UPDATE_INLINE" ) == "1"
219- pipe = None if debug else PIPE
219+ pipe = None if debug else DEVNULL
220220 kwargs = {"stdout" : pipe , "stderr" : pipe }
221221 if not debug and sys .platform == "win32" :
222222 kwargs ["creationflags" ] = CREATE_NO_WINDOW
@@ -230,6 +230,9 @@ def trigger_update(distribution, for_py_version, wheel, search_dirs, app_data, e
230230 )
231231 if debug :
232232 process .communicate () # on purpose not called to make it a background process
233+ else :
234+ # set the returncode here -> no ResourceWarning on main process exit if the subprocess still runs
235+ process .returncode = 0
233236
234237
235238def do_update (distribution , for_py_version , embed_filename , app_data , search_dirs , periodic ): # noqa: PLR0913
0 commit comments