Skip to content

Commit e1d311c

Browse files
authored
Merge pull request modelcontextprotocol#739 from nsheaps/main
fix: correct stdout buffering issues in spawned processes
2 parents 05b279a + 80ab4dc commit e1d311c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cli/src/cli.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ async function runWebClient(args: Args): Promise<void> {
106106
await spawnPromise("node", [inspectorClientPath, ...startArgs], {
107107
signal: abort.signal,
108108
echoOutput: true,
109+
// pipe the stdout through here, prevents issues with buffering and
110+
// dropping the end of console.out after 8192 chars due to node
111+
// closing the stdout pipe before the output has finished flushing
112+
stdio: "inherit",
109113
});
110114
} catch (e) {
111115
if (!cancelled || process.env.DEBUG) throw e;
@@ -151,6 +155,10 @@ async function runCli(args: Args): Promise<void> {
151155
env: { ...process.env, ...args.envArgs },
152156
signal: abort.signal,
153157
echoOutput: true,
158+
// pipe the stdout through here, prevents issues with buffering and
159+
// dropping the end of console.out after 8192 chars due to node
160+
// closing the stdout pipe before the output has finished flushing
161+
stdio: "inherit",
154162
});
155163
} catch (e) {
156164
if (!cancelled || process.env.DEBUG) {

0 commit comments

Comments
 (0)