Skip to content

Commit 16dea9b

Browse files
committed
fix(utils): restore cwd as an optional argument for run_command
1 parent 136e72a commit 16dea9b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

codesectools/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def render_command(command: list, mapping: dict[str, str]) -> list[str]:
104104

105105

106106
def run_command(
107-
command: Sequence[str], cwd: Path, env: dict[str, str] | None = None
107+
command: Sequence[str], cwd: Path | None = None, env: dict[str, str] | None = None
108108
) -> tuple[int | None, str]:
109109
"""Execute a command in a subprocess and capture its output.
110110
@@ -118,6 +118,8 @@ def run_command(
118118
stdout/stderr output as a string.
119119
120120
"""
121+
if cwd is None:
122+
cwd = Path.cwd()
121123
modified_env = {**os.environ, **env} if env else os.environ
122124

123125
process = subprocess.Popen(

0 commit comments

Comments
 (0)