Revert "change demo to utf8 input"

This reverts commit e6e5ecc0f2.
This commit is contained in:
Jörg Breitbart
2019-05-12 22:17:06 +02:00
parent 06c292c11d
commit c0e9bbe87f
3 changed files with 6 additions and 13 deletions
+6 -7
View File
@@ -36,8 +36,7 @@ function startServer() {
cols: cols || 80,
rows: rows || 24,
cwd: process.env.PWD,
env: process.env,
encoding: null
env: process.env
});
console.log('Created terminal with PID: ' + term.pid);
@@ -67,20 +66,20 @@ function startServer() {
ws.send(logs[term.pid]);
function buffer(socket, timeout) {
let buffer = [];
let s = '';
let sender = null;
return (data) => {
buffer.push(data);
s += data;
if (!sender) {
sender = setTimeout(() => {
socket.send(Buffer.concat(buffer));
buffer = [];
socket.send(s);
s = '';
sender = null;
}, timeout);
}
};
}
const send = buffer(ws, 5);
const send = buffer(ws, 5);
term.on('data', function(data) {
try {