fix: add --non-interactive to git_to_svn._run_svn, fix stdin/input exclusivity
This commit is contained in:
@@ -96,16 +96,20 @@ def _run_svn(args: list, input: bytes = None, timeout: int = 120,
|
||||
"""Run an svn command. If *wc* is given, run from that directory."""
|
||||
if auth_args:
|
||||
args = auth_args + args
|
||||
args = ["--non-interactive"] + args
|
||||
env = {**os.environ, "LC_ALL": "C.UTF-8"}
|
||||
try:
|
||||
r = subprocess.run(
|
||||
["svn"] + args,
|
||||
input=input,
|
||||
kwargs = dict(
|
||||
capture_output=True,
|
||||
timeout=timeout,
|
||||
cwd=str(wc) if wc else None,
|
||||
env=env,
|
||||
)
|
||||
if input is not None:
|
||||
kwargs["input"] = input
|
||||
else:
|
||||
kwargs["stdin"] = subprocess.DEVNULL
|
||||
try:
|
||||
r = subprocess.run(["svn"] + args, **kwargs)
|
||||
except FileNotFoundError:
|
||||
raise GitToSVNError("svn CLI not found – is subversion installed?")
|
||||
except subprocess.TimeoutExpired:
|
||||
|
||||
+7
-5
@@ -35,15 +35,17 @@ def _run_svn(args: list, input: bytes = None, timeout: int = 120,
|
||||
args = auth_args + args
|
||||
args = ["--non-interactive"] + args
|
||||
env = {**os.environ, "LC_ALL": "C.UTF-8"}
|
||||
try:
|
||||
r = subprocess.run(
|
||||
["svn"] + args,
|
||||
stdin=subprocess.DEVNULL,
|
||||
input=input,
|
||||
kwargs = dict(
|
||||
capture_output=True,
|
||||
timeout=timeout,
|
||||
env=env,
|
||||
)
|
||||
if input is not None:
|
||||
kwargs["input"] = input
|
||||
else:
|
||||
kwargs["stdin"] = subprocess.DEVNULL
|
||||
try:
|
||||
r = subprocess.run(["svn"] + args, **kwargs)
|
||||
except FileNotFoundError:
|
||||
raise SVNError("svn CLI not found – is subversion installed?")
|
||||
except subprocess.TimeoutExpired:
|
||||
|
||||
Reference in New Issue
Block a user