Skip to content

Commit 75dedcd

Browse files
committed
add cwd to StdioServerParameters
1 parent 3865981 commit 75dedcd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: src/client/stdio.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { ChildProcess, IOType, spawn } from "node:child_process";
22
import process from "node:process";
3+
import { Stream } from "node:stream";
34
import { ReadBuffer, serializeMessage } from "../shared/stdio.js";
4-
import { JSONRPCMessage } from "../types.js";
55
import { Transport } from "../shared/transport.js";
6-
import { Stream } from "node:stream";
6+
import { JSONRPCMessage } from "../types.js";
77

88
export type StdioServerParameters = {
99
/**
@@ -29,6 +29,13 @@ export type StdioServerParameters = {
2929
* The default is "inherit", meaning messages to stderr will be printed to the parent process's stderr.
3030
*/
3131
stderr?: IOType | Stream | number;
32+
33+
/**
34+
* The working directory to use when spawning the process.
35+
*
36+
* If not specified, the current working directory will be inherited.
37+
*/
38+
cwd?: string;
3239
};
3340

3441
/**
@@ -114,6 +121,7 @@ export class StdioClientTransport implements Transport {
114121
shell: false,
115122
signal: this._abortController.signal,
116123
windowsHide: process.platform === "win32" && isElectron(),
124+
cwd: this._serverParams.cwd,
117125
}
118126
);
119127

0 commit comments

Comments
 (0)