@@ -178,8 +178,9 @@ def stop(self) -> None:
178178 self ._kill ()
179179
180180 def _run_process (self , runtests : WorkerRunTests , output_fd : int ,
181+ worker_config : StrPath ,
181182 tmp_dir : StrPath | None = None ) -> int | None :
182- popen = create_worker_process (runtests , output_fd , tmp_dir )
183+ popen = create_worker_process (runtests , output_fd , worker_config , tmp_dir )
183184 self ._popen = popen
184185 self ._killed = False
185186
@@ -293,7 +294,8 @@ def create_worker_runtests(self, test_name: TestName,
293294 ** kwargs )
294295
295296 def run_tmp_files (self , worker_runtests : WorkerRunTests ,
296- stdout_fd : int ) -> tuple [int | None , list [StrPath ]]:
297+ stdout_fd : int ,
298+ worker_config : StrPath ) -> tuple [int | None , list [StrPath ]]:
297299 # gh-93353: Check for leaked temporary files in the parent process,
298300 # since the deletion of temporary files can happen late during
299301 # Python finalization: too late for libregrtest.
@@ -305,12 +307,12 @@ def run_tmp_files(self, worker_runtests: WorkerRunTests,
305307 tmp_dir = os .path .abspath (tmp_dir )
306308 try :
307309 retcode = self ._run_process (worker_runtests ,
308- stdout_fd , tmp_dir )
310+ stdout_fd , worker_config , tmp_dir )
309311 finally :
310312 tmp_files = os .listdir (tmp_dir )
311313 os_helper .rmtree (tmp_dir )
312314 else :
313- retcode = self ._run_process (worker_runtests , stdout_fd )
315+ retcode = self ._run_process (worker_runtests , stdout_fd , worker_config )
314316 tmp_files = []
315317
316318 return (retcode , tmp_files )
@@ -369,9 +371,16 @@ def _runtest(self, test_name: TestName,
369371 worker_runtests = self .create_worker_runtests (
370372 test_name , json_file , module_name = module_name )
371373
374+ worker_config = stack .enter_context (tempfile .NamedTemporaryFile (
375+ 'w' , encoding = 'utf-8' , delete_on_close = False ))
376+ worker_config .write (worker_runtests .as_json ())
377+ # Allow the worker to reopen the file on Windows.
378+ worker_config .close ()
379+
372380 retcode : str | int | None
373381 retcode , tmp_files = self .run_tmp_files (worker_runtests ,
374- stdout_file .fileno ())
382+ stdout_file .fileno (),
383+ worker_config .name )
375384
376385 stdout = self .read_stdout (stdout_file )
377386
0 commit comments