File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -596,6 +596,10 @@ def _second_pass(self) -> Iterator[float]:
596596 yield 100
597597 return
598598
599+ # track temp_dir for cleanup
600+ temp_dir = None
601+ temp_file = None
602+
599603 # special case: if output is a null device, write directly to it
600604 if self .output_file == os .devnull :
601605 cmd .append (self .output_file )
@@ -617,6 +621,10 @@ def _second_pass(self) -> Iterator[float]:
617621 f"Moving temporary file from { temp_file } to { self .output_file } "
618622 )
619623 move (temp_file , self .output_file )
624+ finally :
625+ # clean up temp directory if it was created
626+ if temp_dir and os .path .exists (temp_dir ):
627+ rmtree (temp_dir , ignore_errors = True )
620628
621629 output = cmd_runner .get_output ()
622630 # in the second pass, we do not normalize stream-by-stream, so we set the stats based on the
You can’t perform that action at this time.
0 commit comments