... | ... |
@@ -827,7 +827,9 @@ def cmd_sync_remote2local(args): |
827 | 827 |
os.utime(dst_file, (atime, mtime)) |
828 | 828 |
## FIXME: uid/gid / uname/gname handling comes here! TODO |
829 | 829 |
except OSError, e: |
830 |
- try: dst_stream.close() |
|
830 |
+ try: |
|
831 |
+ dst_stream.close() |
|
832 |
+ os.remove(temp_file) |
|
831 | 833 |
except: pass |
832 | 834 |
if e.errno == errno.EEXIST: |
833 | 835 |
warning(u"%s exists - not overwriting" % (dst_file)) |
... | ... |
@@ -840,19 +842,25 @@ def cmd_sync_remote2local(args): |
840 | 840 |
continue |
841 | 841 |
raise e |
842 | 842 |
except KeyboardInterrupt: |
843 |
- try: dst_stream.close() |
|
843 |
+ try: |
|
844 |
+ dst_stream.close() |
|
845 |
+ os.remove(temp_file) |
|
844 | 846 |
except: pass |
845 | 847 |
warning(u"Exiting after keyboard interrupt") |
846 | 848 |
return |
847 | 849 |
except Exception, e: |
848 |
- try: dst_stream.close() |
|
850 |
+ try: |
|
851 |
+ dst_stream.close() |
|
852 |
+ os.remove(temp_file) |
|
849 | 853 |
except: pass |
850 | 854 |
error(u"%s: %s" % (file, e)) |
851 | 855 |
continue |
852 | 856 |
# We have to keep repeating this call because |
853 | 857 |
# Python 2.4 doesn't support try/except/finally |
854 | 858 |
# construction :-( |
855 |
- try: dst_stream.close() |
|
859 |
+ try: |
|
860 |
+ dst_stream.close() |
|
861 |
+ os.remove(temp_file) |
|
856 | 862 |
except: pass |
857 | 863 |
except S3DownloadError, e: |
858 | 864 |
error(u"%s: download failed too many times. Skipping that file." % file) |