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.
This commit is contained in:
uroma
2026-01-19 19:28:21 +00:00
Unverified
parent ae697ff2f4
commit 7df381ff41
3 changed files with 1 additions and 1 deletions

View File

@@ -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