]> git.proxmox.com Git - mirror_xterm.js.git/commitdiff
Don't crash demo server on refresh
authorDaniel Imms <daimms@microsoft.com>
Thu, 9 Jun 2016 02:28:55 +0000 (19:28 -0700)
committerDaniel Imms <daimms@microsoft.com>
Thu, 9 Jun 2016 02:28:55 +0000 (19:28 -0700)
Fixes #100

demo/app.js

index 77038cc218367cdc63b38047edfc6cf3335a46d6..c48f609199c318184902e2c69a685d12cf75a1aa 100644 (file)
@@ -29,9 +29,12 @@ app.ws('/bash', function(ws, req) {
     cwd: process.env.PWD,
     env: process.env
   });
-
   term.on('data', function(data) {
-    ws.send(data);
+    try {
+      ws.send(data);
+    } catch (ex) {
+      // The WebSocket is not open, ignore
+    }
   });
   ws.on('message', function(msg) {
     term.write(msg);