diff --git a/app/session.js b/app/session.js index 20c2efea..27ff33bc 100644 --- a/app/session.js +++ b/app/session.js @@ -1,5 +1,6 @@ const {exec} = require('child_process'); const {EventEmitter} = require('events'); +const {StringDecoder} = require('string_decoder'); const {app} = require('electron'); const defaultShell = require('default-shell'); @@ -35,6 +36,8 @@ module.exports = class Session extends EventEmitter { TERM_PROGRAM_VERSION: version }, envFromConfig); + const decoder = new StringDecoder('utf8'); + const defaultShellArgs = ['--login']; this.pty = spawn(shell || defaultShell, shellArgs || defaultShellArgs, { @@ -48,7 +51,7 @@ module.exports = class Session extends EventEmitter { if (this.ended) { return; } - this.emit('data', data.toString('utf8')); + this.emit('data', decoder.write(data)); }); this.pty.on('exit', () => {