Previously, if a local destination file system runs out of space, s3cmd
would keep retrying to download files repeatedly forever.
Instead, catch the IOError and terminate appropriately. May as
well catch OSError here too, nothing good can come of it...
... | ... |
@@ -833,6 +833,8 @@ class S3(object): |
833 | 833 |
ConnMan.put(conn) |
834 | 834 |
except ParameterError, e: |
835 | 835 |
raise |
836 |
+ except (IOError, OSError), e: |
|
837 |
+ raise |
|
836 | 838 |
except Exception, e: |
837 | 839 |
if retries: |
838 | 840 |
warning("Retrying failed request: %s (%s)" % (resource['uri'], e)) |
... | ... |
@@ -1040,6 +1042,8 @@ class S3(object): |
1040 | 1040 |
debug("Response: %s" % response) |
1041 | 1041 |
except ParameterError, e: |
1042 | 1042 |
raise |
1043 |
+ except (IOError, OSError), e: |
|
1044 |
+ raise |
|
1043 | 1045 |
except Exception, e: |
1044 | 1046 |
if self.config.progress_meter: |
1045 | 1047 |
progress.done("failed") |
... | ... |
@@ -1092,6 +1096,8 @@ class S3(object): |
1092 | 1092 |
if self.config.progress_meter: |
1093 | 1093 |
progress.update(delta_position = len(data)) |
1094 | 1094 |
ConnMan.put(conn) |
1095 |
+ except (IOError, OSError), e: |
|
1096 |
+ raise |
|
1095 | 1097 |
except Exception, e: |
1096 | 1098 |
if self.config.progress_meter: |
1097 | 1099 |
progress.done("failed") |
... | ... |
@@ -2432,6 +2432,10 @@ if __name__ == '__main__': |
2432 | 2432 |
sys.stderr.write("See ya!\n") |
2433 | 2433 |
sys.exit(1) |
2434 | 2434 |
|
2435 |
+ except (OSError, IOError), e: |
|
2436 |
+ error(e.strerror) |
|
2437 |
+ sys.exit(1) |
|
2438 |
+ |
|
2435 | 2439 |
except MemoryError: |
2436 | 2440 |
msg = """ |
2437 | 2441 |
MemoryError! You have exceeded the amount of memory available for this process. |