Skip to content

Commit

Permalink
don't leave files that will not checksum if download is interrupted
Browse files Browse the repository at this point in the history
  • Loading branch information
Grahame Bowland committed Jan 17, 2012
1 parent 1c7a62c commit ca8fe64
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/etc/snapshot.py
Expand Up @@ -117,7 +117,13 @@ def local_rev_committer_date():
return local_rev_info("ci")

def get_url_to_file(u,f):
subprocess.check_call(["curl", "-o", f, u])
tmpf = f + '.tmp' # no security issue, just to stop partial download leaving a stale file
try:
subprocess.check_call(["curl", "-o", tmpf, u])
except subprocess.CalledProcessError:
os.unlink(tmpf)
raise
os.rename(tmpf, f)

def snap_filename_hash_part(snap):
match = re.match(r".*([a-fA-F\d]{40}).tar.bz2$", snap)
Expand Down

0 comments on commit ca8fe64

Please sign in to comment.