diff options
author | aiju <devnull@localhost> | 2017-02-26 01:13:13 +0100 |
---|---|---|
committer | aiju <devnull@localhost> | 2017-02-26 01:13:13 +0100 |
commit | 9f2c7606ab35c3f70a93e7c59fbae833603906c6 (patch) | |
tree | be1802ebbd9f28cd5a8ac351022d07fc39378d36 /sys/lib/python | |
parent | 6651be7516550848f02778636fb8a7b08b5aac83 (diff) |
hgwebfs: keep trying as long as we get needkey response
Diffstat (limited to 'sys/lib/python')
-rw-r--r-- | sys/lib/python/hgext/hgwebfs.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/sys/lib/python/hgext/hgwebfs.py b/sys/lib/python/hgext/hgwebfs.py index 5a5b260eb..91a98adde 100644 --- a/sys/lib/python/hgext/hgwebfs.py +++ b/sys/lib/python/hgext/hgwebfs.py @@ -6,20 +6,22 @@ import os class Webconn: def __init__(self, mnt, req): - try: - self.open(mnt, req) - except IOError, e: + loop = True + while loop: + loop = False try: - errstr = e.strerror - params = errstr[errstr.index("needkey ")+8:] - if params.find("!password?") < 0: - raise e - if os.spawnl(os.P_WAIT, "/boot/factotum", "getkey", "-g", params) != 0: - raise e self.open(mnt, req) - return - except: - raise e + except IOError, e: + try: + errstr = e.strerror + params = errstr[errstr.index("needkey ")+8:] + if params.find("!password?") < 0: + raise e + if os.spawnl(os.P_WAIT, "/boot/factotum", "getkey", "-g", params) != 0: + raise e + loop = True + except: + raise e def open(self, mnt, req): if type(req) == str: |