BORG_PASSCOMMAND: use same cmd-string splitting as BORG_RSH

This commit is contained in:
Marian Beermann 2017-05-31 19:41:17 +02:00
parent 349a4ade7c
commit 4e6a771ee7
1 changed files with 2 additions and 1 deletions

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 @@ class Passphrase(str):
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'))