Skip to content

Commit

Permalink
Merge pull request #4237 from cservakt/new-tmp-dir
Browse files Browse the repository at this point in the history
[fix] Creating new temporary directory for zip files
  • Loading branch information
bruntib committed May 21, 2024
2 parents a7a4495 + 9045e7b commit b1727a0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion web/client/codechecker_client/cmd/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import tempfile
import zipfile
import zlib
import shutil

from collections import defaultdict, namedtuple
from contextlib import contextmanager
Expand Down Expand Up @@ -894,7 +895,16 @@ def main(args):
port,
product_name=product_name)

zip_file_handle, zip_file = tempfile.mkstemp('.zip')
try:
temp_dir = tempfile.mkdtemp(suffix="-store", dir=args.input[0])
LOG.debug(f"{temp_dir} directory created successfully!")
except PermissionError:
LOG.error(f"Permission denied! You do not have sufficient "
f"permissions to create the {temp_dir} "
"temporary directory.")
sys.exit(1)

zip_file_handle, zip_file = tempfile.mkstemp(suffix=".zip", dir=temp_dir)
LOG.debug("Will write mass store ZIP to '%s'...", zip_file)

try:
Expand Down Expand Up @@ -1007,3 +1017,5 @@ def main(args):
finally:
os.close(zip_file_handle)
os.remove(zip_file)
if os.path.exists(temp_dir):
shutil.rmtree(temp_dir)

0 comments on commit b1727a0

Please sign in to comment.