Mercurial > hg-stable
comparison hgext/factotum.py @ 23393:c834c0194dbb
factotum: convert Plan 9 quoted string to Python string
author | David Eckhardt <David.Eckhardt@cs.cmu.edu> |
---|---|
date | Tue, 25 Nov 2014 02:31:52 -0600 |
parents | be561a622100 |
children | e8348f1cc228 |
comparison
equal
deleted
inserted
replaced
23392:d66547df8207 | 23393:c834c0194dbb |
---|---|
70 try: | 70 try: |
71 os.write(fd, 'start %s' % params) | 71 os.write(fd, 'start %s' % params) |
72 l = os.read(fd, ERRMAX).split() | 72 l = os.read(fd, ERRMAX).split() |
73 if l[0] == 'ok': | 73 if l[0] == 'ok': |
74 os.write(fd, 'read') | 74 os.write(fd, 'read') |
75 l = os.read(fd, ERRMAX).split() | 75 status, user, passwd = os.read(fd, ERRMAX).split(None, 2) |
76 if l[0] == 'ok': | 76 if status == 'ok': |
77 return l[1:] | 77 if passwd.startswith("'"): |
78 if passwd.endswith("'"): | |
79 passwd = passwd[1:-1].replace("''", "'") | |
80 else: | |
81 raise util.Abort(_('malformed password string')) | |
82 return (user, passwd) | |
78 except (OSError, IOError): | 83 except (OSError, IOError): |
79 raise util.Abort(_('factotum not responding')) | 84 raise util.Abort(_('factotum not responding')) |
80 finally: | 85 finally: |
81 os.close(fd) | 86 os.close(fd) |
82 getkey(self, params) | 87 getkey(self, params) |