add cwd to StdioServerParameters (#292)
This commit is contained in:
parent
08f4e01b8f
commit
805fb469f5
1 changed files with 5 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from contextlib import asynccontextmanager
|
from contextlib import asynccontextmanager
|
||||||
|
from pathlib import Path
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
|
|
||||||
import anyio
|
import anyio
|
||||||
|
|
@ -66,6 +67,9 @@ class StdioServerParameters(BaseModel):
|
||||||
If not specified, the result of get_default_environment() will be used.
|
If not specified, the result of get_default_environment() will be used.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
cwd: str | Path | None = None
|
||||||
|
"""The working directory to use when spawning the process."""
|
||||||
|
|
||||||
encoding: str = "utf-8"
|
encoding: str = "utf-8"
|
||||||
"""
|
"""
|
||||||
The text encoding used when sending/receiving messages to the server
|
The text encoding used when sending/receiving messages to the server
|
||||||
|
|
@ -101,6 +105,7 @@ async def stdio_client(server: StdioServerParameters):
|
||||||
[server.command, *server.args],
|
[server.command, *server.args],
|
||||||
env=server.env if server.env is not None else get_default_environment(),
|
env=server.env if server.env is not None else get_default_environment(),
|
||||||
stderr=sys.stderr,
|
stderr=sys.stderr,
|
||||||
|
cwd=server.cwd,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def stdout_reader():
|
async def stdout_reader():
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue