Skip to content

Commit 0530dee

Browse files
committed
Accept general kwargs for subprocess run
Since subprocess run should be doing it's own type checking let it handle kwargs. Rather than enumerating each of it's arguments in Context.run's definition.
1 parent c76fc93 commit 0530dee

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/ptscripts/parser.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def run(
149149
no_output_timeout_secs: int | None = None,
150150
capture: bool = False,
151151
interactive: bool = False,
152+
**kwargs,
152153
) -> CompletedProcess[str]:
153154
"""
154155
Run a subprocess.
@@ -160,6 +161,7 @@ def run(
160161
no_output_timeout_secs=no_output_timeout_secs,
161162
capture=capture,
162163
interactive=interactive,
164+
**kwargs,
163165
)
164166

165167
@contextmanager

src/ptscripts/process.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,10 @@ async def _subprocess_run(
206206
no_output_timeout_secs: int | None = None,
207207
capture: bool = False,
208208
interactive: bool = False,
209+
**kwargs,
209210
):
210211
stdout = subprocess.PIPE
211212
stderr = subprocess.PIPE
212-
kwargs = {}
213213
if interactive is False:
214214
# Run in a separate program group
215215
if sys.platform.startswith("win"):
@@ -249,6 +249,7 @@ def run(
249249
no_output_timeout_secs: int | None = None,
250250
capture: bool = False,
251251
interactive: bool = False,
252+
**kwargs,
252253
) -> subprocess.CompletedProcess[str]:
253254
"""
254255
Run a command.
@@ -265,6 +266,7 @@ def run(
265266
no_output_timeout_secs=no_output_timeout_secs,
266267
capture=capture,
267268
interactive=interactive,
269+
**kwargs,
268270
)
269271
)
270272
result = future.result()

0 commit comments

Comments
 (0)