diff options
-rw-r--r-- | project.py | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -1529,7 +1529,7 @@ class Project(object): | |||
1529 | if os.path.exists(dstPath): | 1529 | if os.path.exists(dstPath): |
1530 | os.remove(dstPath) | 1530 | os.remove(dstPath) |
1531 | 1531 | ||
1532 | cmd = ['curl', '--output', tmpPath, '--netrc', '--location'] | 1532 | cmd = ['curl', '--fail', '--output', tmpPath, '--netrc', '--location'] |
1533 | if quiet: | 1533 | if quiet: |
1534 | cmd += ['--silent'] | 1534 | cmd += ['--silent'] |
1535 | if os.path.exists(tmpPath): | 1535 | if os.path.exists(tmpPath): |
@@ -1549,9 +1549,19 @@ class Project(object): | |||
1549 | except OSError: | 1549 | except OSError: |
1550 | return False | 1550 | return False |
1551 | 1551 | ||
1552 | ok = proc.wait() == 0 | 1552 | curlret = proc.wait() |
1553 | |||
1554 | if curlret == 22: | ||
1555 | # From curl man page: | ||
1556 | # 22: HTTP page not retrieved. The requested url was not found or | ||
1557 | # returned another error with the HTTP error code being 400 or above. | ||
1558 | # This return code only appears if -f, --fail is used. | ||
1559 | if not quiet: | ||
1560 | print >> sys.stderr, "Server does not provide clone.bundle; ignoring." | ||
1561 | return False | ||
1562 | |||
1553 | if os.path.exists(tmpPath): | 1563 | if os.path.exists(tmpPath): |
1554 | if ok and os.stat(tmpPath).st_size > 16: | 1564 | if curlret == 0 and os.stat(tmpPath).st_size > 16: |
1555 | os.rename(tmpPath, dstPath) | 1565 | os.rename(tmpPath, dstPath) |
1556 | return True | 1566 | return True |
1557 | else: | 1567 | else: |