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:
commit
1b66d8d109
1 changed files with 2 additions and 1 deletions
|
@ -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'))
|
||||||
|
|
Loading…
Reference in a new issue