mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Preserve multi-byte encoded utf-8 characters (#769)
This commit is contained in:
parent
7aa20a8d45
commit
de1a01ff57
1 changed files with 4 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
const {exec} = require('child_process');
|
const {exec} = require('child_process');
|
||||||
const {EventEmitter} = require('events');
|
const {EventEmitter} = require('events');
|
||||||
|
const {StringDecoder} = require('string_decoder');
|
||||||
|
|
||||||
const {app} = require('electron');
|
const {app} = require('electron');
|
||||||
const defaultShell = require('default-shell');
|
const defaultShell = require('default-shell');
|
||||||
|
|
@ -35,6 +36,8 @@ module.exports = class Session extends EventEmitter {
|
||||||
TERM_PROGRAM_VERSION: version
|
TERM_PROGRAM_VERSION: version
|
||||||
}, envFromConfig);
|
}, envFromConfig);
|
||||||
|
|
||||||
|
const decoder = new StringDecoder('utf8');
|
||||||
|
|
||||||
const defaultShellArgs = ['--login'];
|
const defaultShellArgs = ['--login'];
|
||||||
|
|
||||||
this.pty = spawn(shell || defaultShell, shellArgs || defaultShellArgs, {
|
this.pty = spawn(shell || defaultShell, shellArgs || defaultShellArgs, {
|
||||||
|
|
@ -48,7 +51,7 @@ module.exports = class Session extends EventEmitter {
|
||||||
if (this.ended) {
|
if (this.ended) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.emit('data', data.toString('utf8'));
|
this.emit('data', decoder.write(data));
|
||||||
});
|
});
|
||||||
|
|
||||||
this.pty.on('exit', () => {
|
this.pty.on('exit', () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue