Skip to content

Commit

Permalink
update dir rm
Browse files Browse the repository at this point in the history
  • Loading branch information
CTY-git committed May 8, 2024
1 parent 89ea7d1 commit 8b996c4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions patchwork/steps/ScanDepscan/ScanDepscan.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import atexit
import os
import shutil
import subprocess
import tempfile
from pathlib import Path
Expand Down Expand Up @@ -87,7 +88,8 @@ def run(self) -> dict:
temporary directory exists and is writable.
"""
# Generate a unique temporary file path
temp_file_path = Path(tempfile.mktemp())
temp_file_path = Path(tempfile.mkdtemp())
atexit.register(shutil.rmtree, temp_file_path, ignore_errors=True)

cmd = [
"depscan",
Expand All @@ -104,7 +106,6 @@ def run(self) -> dict:

p = subprocess.run(cmd, capture_output=True, text=True)

atexit.register(temp_file_path.unlink, True)
sbom_vdr_file_path = os.path.join(temp_file_path, sbom_vdr_file_name + ".vdr.json")

logger.info(f"Run completed {self.__class__.__name__}")
Expand Down

0 comments on commit 8b996c4

Please sign in to comment.