From 74df6920e974c14429a6cf158345a28dca782fd2 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Mon, 9 Jan 2017 10:05:44 -0800 Subject: [PATCH] fix decoding race condition with new terminal sessions (#1366) --- lib/components/term.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/components/term.js b/lib/components/term.js index 489f9a1c..7435070d 100644 --- a/lib/components/term.js +++ b/lib/components/term.js @@ -150,6 +150,19 @@ export default class Term extends Component { } write(data) { + // sometimes the preference set above for + // `receive-encoding` is not known by the vt + // before we type to write (since the preference + // manager is asynchronous), so we force it to + // avoid buffering + // this fixes a race condition where sometimes + // opening new sessions results in broken + // output due to the term attempting to decode + // as `utf-8` instead of `raw` + if (this.term.vt.characterEncoding !== 'raw') { + this.term.vt.characterEncoding = 'raw'; + } + this.term.io.writeUTF8(data); }