From cf6dfaf784fe76765eb8b67ac56c60c8852d585e Mon Sep 17 00:00:00 2001 From: NI Date: Tue, 1 Oct 2019 15:52:43 +0800 Subject: [PATCH] Refuse console input when the terminal is closed --- ui/widgets/screen_console.vue | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ui/widgets/screen_console.vue b/ui/widgets/screen_console.vue index cf5bda1..080d794 100644 --- a/ui/widgets/screen_console.vue +++ b/ui/widgets/screen_console.vue @@ -75,6 +75,7 @@ class Term { constructor(control) { const resizeDelayInterval = 500; + this.closed = false; this.term = new Terminal({ allowTransparency: false, cursorBlink: true, @@ -91,10 +92,18 @@ class Term { }); this.term.onData(data => { + if (this.closed) { + return; + } + control.send(data); }); this.term.onKey(ev => { + if (this.closed) { + return; + } + if (!control.echo()) { return; } @@ -252,6 +261,8 @@ class Term { } destroy() { + this.closed = true; + try { this.term.dispose(); } catch (e) {