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."""
|
"""Run an svn command. If *wc* is given, run from that directory."""
|
||||||
if auth_args:
|
if auth_args:
|
||||||
args = auth_args + args
|
args = auth_args + args
|
||||||
|
args = ["--non-interactive"] + args
|
||||||
env = {**os.environ, "LC_ALL": "C.UTF-8"}
|
env = {**os.environ, "LC_ALL": "C.UTF-8"}
|
||||||
try:
|
kwargs = dict(
|
||||||
r = subprocess.run(
|
|
||||||
["svn"] + args,
|
|
||||||
input=input,
|
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
cwd=str(wc) if wc else None,
|
cwd=str(wc) if wc else None,
|
||||||
env=env,
|
env=env,
|
||||||
)
|
)
|
||||||
|
if input is not None:
|
||||||
|
kwargs["input"] = input
|
||||||
|
else:
|
||||||
|
kwargs["stdin"] = subprocess.DEVNULL
|
||||||
|
try:
|
||||||
|
r = subprocess.run(["svn"] + args, **kwargs)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
raise GitToSVNError("svn CLI not found – is subversion installed?")
|
raise GitToSVNError("svn CLI not found – is subversion installed?")
|
||||||
except subprocess.TimeoutExpired:
|
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 = auth_args + args
|
||||||
args = ["--non-interactive"] + args
|
args = ["--non-interactive"] + args
|
||||||
env = {**os.environ, "LC_ALL": "C.UTF-8"}
|
env = {**os.environ, "LC_ALL": "C.UTF-8"}
|
||||||
try:
|
kwargs = dict(
|
||||||
r = subprocess.run(
|
|
||||||
["svn"] + args,
|
|
||||||
stdin=subprocess.DEVNULL,
|
|
||||||
input=input,
|
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
env=env,
|
env=env,
|
||||||
)
|
)
|
||||||
|
if input is not None:
|
||||||
|
kwargs["input"] = input
|
||||||
|
else:
|
||||||
|
kwargs["stdin"] = subprocess.DEVNULL
|
||||||
|
try:
|
||||||
|
r = subprocess.run(["svn"] + args, **kwargs)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
raise SVNError("svn CLI not found – is subversion installed?")
|
raise SVNError("svn CLI not found – is subversion installed?")
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
|
|||||||
Reference in New Issue
Block a user