Skip to content

Commit c45f125

Browse files
authored
Refactor subprocess creation to simplify code
1 parent a09e090 commit c45f125

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

src/acp/transports.py

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,16 @@ async def spawn_stdio_transport(
6363
if env:
6464
merged_env.update(env)
6565

66-
if limit is None:
67-
process = await asyncio.create_subprocess_exec(
68-
command,
69-
*args,
70-
stdin=aio_subprocess.PIPE,
71-
stdout=aio_subprocess.PIPE,
72-
stderr=stderr,
73-
env=merged_env,
74-
cwd=str(cwd) if cwd is not None else None,
75-
)
76-
else:
77-
process = await asyncio.create_subprocess_exec(
78-
command,
79-
*args,
80-
stdin=aio_subprocess.PIPE,
81-
stdout=aio_subprocess.PIPE,
82-
stderr=stderr,
83-
env=merged_env,
84-
cwd=str(cwd) if cwd is not None else None,
85-
limit=limit,
86-
)
66+
process = await asyncio.create_subprocess_exec(
67+
command,
68+
*args,
69+
stdin=aio_subprocess.PIPE,
70+
stdout=aio_subprocess.PIPE,
71+
stderr=stderr,
72+
env=merged_env,
73+
cwd=str(cwd) if cwd is not None else None,
74+
limit=limit,
75+
)
8776

8877
if process.stdout is None or process.stdin is None:
8978
process.kill()

0 commit comments

Comments
 (0)