Skip to content

Conversation

@omerporze
Copy link

fix: avoid blocking os.getcwd() call in async subprocess creation

asyncio.create_subprocess_exec() internally calls os.getcwd() when the

cwd parameter is not specified. This blocking call causes issues in ASGI

servers that detect and prevent blocking operations on the event loop.

This fix pre-fetches the current working directory using asyncio.to_thread()

and passes it explicitly to create_subprocess_exec(), avoiding the blocking

call during subprocess creation.

fix: avoid blocking os.getcwd() call in async subprocess creation

asyncio.create_subprocess_exec() internally calls os.getcwd() when the

cwd parameter is not specified. This blocking call causes issues in ASGI

servers that detect and prevent blocking operations on the event loop.

This fix pre-fetches the current working directory using asyncio.to_thread()

and passes it explicitly to create_subprocess_exec(), avoiding the blocking

call during subprocess creation.
@omerporze omerporze changed the title Update _transport.py fix blocking getcwd on async playwright Jan 4, 2026
@omerporze omerporze closed this Jan 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant