File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
packages/cli-v3/src/mcp/tools Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments