From 7df381ff41fbf4443a5357b1e1dc028a9deb1842 Mon Sep 17 00:00:00 2001 From: uroma Date: Mon, 19 Jan 2026 19:28:21 +0000 Subject: [PATCH] fix: await switchToTerminal to prevent race condition The issue was that switchToTerminal() was not being awaited, so launchCommand() was called while switchToTerminal() was still executing. This caused a race condition where the WebSocket closed before the command could be sent. By awaiting switchToTerminal(), we ensure the terminal is fully switched before attempting to send any commands. --- database.sqlite-shm | Bin 32768 -> 32768 bytes database.sqlite-wal | Bin 931152 -> 980592 bytes public/claude-ide/terminal.js | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) diff --git a/database.sqlite-shm b/database.sqlite-shm index cf04ed7655c7e479b7024a9cf7a77af96cfcbd46..c0912ec1887f490010eda8cb02aaae1eb55d4ca1 100644 GIT binary patch delta 212 zcmZo@U}|V!s+V}A%K!o_K+MR%An*=Ia{{rEaNYlE$MxlVQ)4ztca$7Ic~gE}muss7 zsp^47fdR?Z$nn#TT^;W@)AhPRsqSrVBh|8ezTe!}nq p$l1&^`Im&lp}ZykU3;6v<}V{3Vb_4*)uKOi2I$ delta 192 zcmZo@U}|V!s+V}A%K!o_K+MR%An*uCa{_Vdg*3L86>Oq=Q)4ztca$7Y?DmM9|N3n| zsp^47fdRxLG_7N!>F7M2#)7Pc1l7LFFq7OocV7M>Q~Eqno{({Eg26yP{_T!{bU zR`a!!1tv-hN-!`mZ~`$a5HkaD^kkcf#*7l%Pbf2O;OA(&-?mhhRn}sALJ^~Y0B6cp z-J{382h8KzesB{bzW_(Fp2)(RDU051pD+n1&9PWF;GweegU4{QSIEZrM1dGYcyJlk&^0&(Z$w0>4F7M2#)7Pc1l7LFFq7OocV7M>Q~Eqno{03C%4-~a#s diff --git a/public/claude-ide/terminal.js b/public/claude-ide/terminal.js index e69d5d2f..00a2c86f 100644 --- a/public/claude-ide/terminal.js +++ b/public/claude-ide/terminal.js @@ -276,7 +276,7 @@ class TerminalManager { // Switch to new terminal this.debugLog('INIT', `Switching to terminal ${terminalId}...`); - this.switchToTerminal(terminalId); + await this.switchToTerminal(terminalId); this.debugLog('INIT', `Switched to terminal ${terminalId}`); // Handle terminal type specific initialization