Skip to content

Commit 1647b1c

Browse files
committed
Fix another devin review comment
1 parent 8784c00 commit 1647b1c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/cli-v3/src/mcp/tools/devServer.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ export const startDevServerTool = {
8686
});
8787

8888
// Stream output in the background
89+
const myProcess = devProcess;
8990
const readOutput = async () => {
9091
try {
91-
for await (const line of devProcess!) {
92+
for await (const line of myProcess) {
9293
const clean = stripAnsi(line);
9394
pushLog(clean);
9495

@@ -104,8 +105,12 @@ export const startDevServerTool = {
104105
// Process ended
105106
}
106107

107-
// When the process exits
108-
const exitCode = devProcess?.exitCode;
108+
// Only update module state if no new server has been started since
109+
if (devProcess !== myProcess) {
110+
return;
111+
}
112+
113+
const exitCode = myProcess.exitCode;
109114
if (devState !== "error") {
110115
devState = "stopped";
111116
}

0 commit comments

Comments
 (0)