1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-27 02:08:54 +00:00

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

View file

@ -1,6 +1,7 @@
import configparser import configparser
import getpass import getpass
import os import os
import shlex
import sys import sys
import textwrap import textwrap
import subprocess import subprocess
@ -430,7 +431,7 @@ def env_passcommand(cls, default=None):
passcommand = os.environ.get('BORG_PASSCOMMAND', None) passcommand = os.environ.get('BORG_PASSCOMMAND', None)
if passcommand is not None: if passcommand is not None:
try: 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: except (subprocess.CalledProcessError, FileNotFoundError) as e:
raise PasscommandFailure(e) raise PasscommandFailure(e)
return cls(passphrase.rstrip('\n')) return cls(passphrase.rstrip('\n'))