mirror of https://github.com/borgbackup/borg.git
BORG_PASSCOMMAND: use same cmd-string splitting as BORG_RSH
(cherry picked from commit 4e6a771ee7
)
This commit is contained in:
parent
8c1da1adda
commit
cf0d28a24f
|
@ -2,6 +2,7 @@ from binascii import hexlify, a2b_base64, b2a_base64
|
||||||
import configparser
|
import configparser
|
||||||
import getpass
|
import getpass
|
||||||
import os
|
import os
|
||||||
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
|
@ -327,7 +328,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'))
|
||||||
|
|
Loading…
Reference in New Issue