MCPcopy Create free account
hub / github.com/commitizen-tools/commitizen / run_interactive

Function run_interactive

commitizen/cmd.py:108–130  ·  view source on GitHub ↗

Run a command safely without shell interpretation and without redirecting stdin, stdout, or stderr Args: cmd: The command to run env: Extra environment variables to define in the subprocess. Defaults to None. Returns: subprocess returncode

(
    cmd: str | Sequence[str], env: Mapping[str, str] | None = None
)

Source from the content-addressed store, hash-verified

106
107
108def run_interactive(
109 cmd: str | Sequence[str], env: Mapping[str, str] | None = None
110) -> int:
111 """Run a command safely without shell interpretation and without redirecting stdin, stdout, or stderr
112
113 Args:
114 cmd: The command to run
115 env: Extra environment variables to define in the subprocess. Defaults to None.
116
117 Returns:
118 subprocess returncode
119 """
120 if env is not None:
121 env = {**os.environ, **env}
122 if isinstance(cmd, str):
123 warnings.warn(
124 "Passing a string to cmd.run_interactive() is deprecated and will be removed in v5. "
125 "Use a list of arguments instead, or use cmd.run_interactive_shell() explicitly.",
126 DeprecationWarning,
127 stacklevel=2,
128 )
129 return subprocess.run(cmd, shell=True, env=env).returncode
130 return subprocess.run(cmd, shell=False, env=env).returncode
131
132
133def run_interactive_shell(cmd: str, env: Mapping[str, str] | None = None) -> int:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected