From dca6861940d3eab1731ad9d24e706ff76c5d5dbc Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Fri, 9 May 2025 16:36:53 +0800 Subject: [PATCH] fix: remove writng error user terminal on disconnecting --- app/src/utils/terminal.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/src/utils/terminal.ts b/app/src/utils/terminal.ts index a32ff1b..ec2ef91 100644 --- a/app/src/utils/terminal.ts +++ b/app/src/utils/terminal.ts @@ -31,6 +31,7 @@ class SocketTerminal { connect(url: string): Promise { return new Promise((resolve, reject) => { console.log('Connecting to terminal', url) + this.term.write('\r\n\x1B[1;32mConnecting to terminal\x1B[0m\r\n') this.socket = new ReconnectingWebSocket(url, [], { connectionTimeout: 5000, maxRetries: 10, @@ -44,14 +45,10 @@ class SocketTerminal { this.socket.onclose = () => { console.log('Disconnected from terminal') - this.term.write('\r\n\x1B[1;31mDisconnected from terminal\x1B[0m\r\n') } this.socket.onerror = (error) => { console.error('WebSocket error:', error) - this.term.write( - `\r\n\x1B[1;31mWebSocket error: ${'message' in error ? error.message : ''}\x1B[0m\r\n` - ) } this.socket.onmessage = (event) => { console.log('Received message from terminal')