@@ -11,6 +11,7 @@ import { Unicode11Addon } from "@xterm/addon-unicode11";
1111import { WebLinksAddon } from "@xterm/addon-web-links" ;
1212import { WebglAddon } from "@xterm/addon-webgl" ;
1313import { Terminal as Xterm } from "@xterm/xterm" ;
14+ import toast from "components/toast" ;
1415import confirm from "dialogs/confirm" ;
1516import fonts from "lib/fonts" ;
1617import keyBindings from "lib/keyBindings" ;
@@ -524,7 +525,8 @@ export default class TerminalComponent {
524525
525526 // If AXS still not running after retries, throw error
526527 if ( ! ( await Terminal . isAxsRunning ( ) ) ) {
527- throw new Error ( "Failed to start AXS server after multiple attempts" ) ;
528+ toast ( "Failed to start AXS server after multiple attempts" ) ;
529+ //throw new Error("Failed to start AXS server after multiple attempts");
528530 }
529531 }
530532
@@ -589,6 +591,22 @@ export default class TerminalComponent {
589591 this . fit ( ) ;
590592 } ;
591593
594+ this . websocket . onmessage = ( event ) => {
595+ // Handle text messages (exit events)
596+ if ( typeof event . data === "string" ) {
597+ try {
598+ const message = JSON . parse ( event . data ) ;
599+ if ( message . type === "exit" ) {
600+ this . onProcessExit ?. ( message . data ) ;
601+ return ;
602+ }
603+ } catch ( error ) {
604+ // Not a JSON message, let attachAddon handle it
605+ }
606+ }
607+ // For binary data or non-exit text messages, let attachAddon handle them
608+ } ;
609+
592610 this . websocket . onclose = ( event ) => {
593611 this . isConnected = false ;
594612 this . onDisconnect ?. ( ) ;
@@ -918,4 +936,5 @@ export default class TerminalComponent {
918936 onError ( error ) { }
919937 onTitleChange ( title ) { }
920938 onBell ( ) { }
939+ onProcessExit ( exitData ) { }
921940}
0 commit comments