Mercurial > hg-stable
changeset 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 | d66547df8207 |
children | b5e2128ce9e6 |
files | hgext/factotum.py |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/factotum.py Tue Nov 25 02:27:31 2014 -0600 +++ b/hgext/factotum.py Tue Nov 25 02:31:52 2014 -0600 @@ -72,9 +72,14 @@ l = os.read(fd, ERRMAX).split() if l[0] == 'ok': os.write(fd, 'read') - l = os.read(fd, ERRMAX).split() - if l[0] == 'ok': - return l[1:] + status, user, passwd = os.read(fd, ERRMAX).split(None, 2) + if status == 'ok': + if passwd.startswith("'"): + if passwd.endswith("'"): + passwd = passwd[1:-1].replace("''", "'") + else: + raise util.Abort(_('malformed password string')) + return (user, passwd) except (OSError, IOError): raise util.Abort(_('factotum not responding')) finally: