diff options
| author | Graydon Hoare <graydon@pobox.com> | 2012-01-17 12:43:30 -0800 |
|---|---|---|
| committer | Graydon Hoare <graydon@pobox.com> | 2012-01-17 12:43:30 -0800 |
| commit | 65e3c35c8d90fd3e4be8765b3c9eb755c52691ef (patch) | |
| tree | c7dfddcdb0c53261c8ee72e5f2b092b56ba418b5 /src | |
| parent | f14ee0b1b6c36528f14661a8f67d6808ba895978 (diff) | |
| parent | ca8fe6446b52073b11e7717012e7e9dfa32f1938 (diff) | |
| download | rust-65e3c35c8d90fd3e4be8765b3c9eb755c52691ef.tar.gz rust-65e3c35c8d90fd3e4be8765b3c9eb755c52691ef.zip | |
Merge pull request #1548 from grahame/fix-interrupted-downloads
don't leave files that will not checksum if download is interrupted
Diffstat (limited to 'src')
| -rw-r--r-- | src/etc/snapshot.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/etc/snapshot.py b/src/etc/snapshot.py index 48e5e0bfd02..874baccb7b3 100644 --- a/src/etc/snapshot.py +++ b/src/etc/snapshot.py @@ -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) |
