calibredb: Fix a regression that broke reading of passwords from stdin

This commit is contained in:
Kovid Goyal 2018-01-21 18:27:02 +05:30
parent d2cd03d891
commit 9e199774c1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -126,7 +126,7 @@ def read_credentials(opts):
if pw: if pw:
if pw == '<stdin>': if pw == '<stdin>':
from calibre.utils.unicode_getpass import getpass from calibre.utils.unicode_getpass import getpass
pw = getpass.getpass(_('Enter the password: ')) pw = getpass(_('Enter the password: '))
elif pw.startswith('<f:') and pw.endswith('>'): elif pw.startswith('<f:') and pw.endswith('>'):
with lopen(pw[3:-1], 'rb') as f: with lopen(pw[3:-1], 'rb') as f:
pw = f.read().decode('utf-8').rstrip() pw = f.read().decode('utf-8').rstrip()