password_command failures are now fatal

This commit is contained in:
Markus Unterwaditzer 2015-07-07 15:38:42 +02:00
parent 39a11994f8
commit 776bfa2f4f
2 changed files with 10 additions and 4 deletions

View file

@ -9,6 +9,12 @@ Package maintainers and users who have to manually update their installation
may want to subscribe to `GitHub's tag feed
<https://github.com/untitaker/vdirsyncer/tags.atom>`_.
Version 0.5.3
=============
- ``password_command`` invocations with non-zero exit code are now fatal (and
will abort synchronization) instead of just producing a warning.
Version 0.5.2
=============

View file

@ -4,7 +4,7 @@ import threading
from . import expand_path
from .compat import urlparse
from .. import log
from .. import exceptions, log
from ..doubleclick import click, ctx
logger = log.get(__name__)
@ -115,7 +115,7 @@ def _password_from_command(username, host):
try:
stdout = subprocess.check_output(command + [username, host],
universal_newlines=True)
return stdout.strip()
return stdout.strip('\n') or None
except OSError as e:
logger.warning('Failed to execute command: {}\n{}'.
format(' '.join(command), str(e)))
raise exceptions.UserError('Failed to execute command: {}\n{}'.
format(' '.join(command), str(e)))