Merge pull request #2576 from enkore/pr/2573+split

BORG_PASSCOMMAND: use same cmd-string splitting as BORG_RSH
This commit is contained in:
enkore 2017-05-31 19:41:42 +02:00 committed by GitHub
commit 1b66d8d109
1 changed files with 2 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import configparser
import getpass
import os
import shlex
import sys
import textwrap
import subprocess
@ -430,7 +431,7 @@ class Passphrase(str):
passcommand = os.environ.get('BORG_PASSCOMMAND', None)
if passcommand is not None:
try:
passphrase = subprocess.check_output(passcommand.split(), universal_newlines=True)
passphrase = subprocess.check_output(shlex.split(passcommand), universal_newlines=True)
except (subprocess.CalledProcessError, FileNotFoundError) as e:
raise PasscommandFailure(e)
return cls(passphrase.rstrip('\n'))