Move to pty-node over custom pty2.js
This commit is contained in:
parent
63ff2a6057
commit
f6f1de4bd8
|
@ -10,7 +10,7 @@ const resolveMimeType = require('./mime_util.js').resolveMimeType;
|
|||
// base/modules
|
||||
const fs = require('graceful-fs');
|
||||
const _ = require('lodash');
|
||||
const pty = require('ptyw.js');
|
||||
const pty = require('node-pty');
|
||||
|
||||
let archiveUtil;
|
||||
|
||||
|
|
18
core/door.js
18
core/door.js
|
@ -6,7 +6,7 @@ const stringFormat = require('./string_format.js');
|
|||
|
||||
const events = require('events');
|
||||
const _ = require('lodash');
|
||||
const pty = require('ptyw.js');
|
||||
const pty = require('node-pty');
|
||||
const decode = require('iconv-lite').decode;
|
||||
const createServer = require('net').createServer;
|
||||
|
||||
|
@ -18,8 +18,7 @@ function Door(client, exeInfo) {
|
|||
const self = this;
|
||||
this.client = client;
|
||||
this.exeInfo = exeInfo;
|
||||
this.exeInfo.encoding = this.exeInfo.encoding || 'cp437';
|
||||
this.exeInfo.encoding = this.exeInfo.encoding.toLowerCase();
|
||||
this.exeInfo.encoding = (this.exeInfo.encoding || 'cp437').toLowerCase();
|
||||
let restored = false;
|
||||
|
||||
//
|
||||
|
@ -36,11 +35,7 @@ function Door(client, exeInfo) {
|
|||
//
|
||||
|
||||
this.doorDataHandler = function(data) {
|
||||
if(self.client.term.outputEncoding === self.exeInfo.encoding) {
|
||||
self.client.term.rawWrite(data);
|
||||
} else {
|
||||
self.client.term.write(decode(data, self.exeInfo.encoding));
|
||||
}
|
||||
self.client.term.write(decode(data, self.exeInfo.encoding));
|
||||
};
|
||||
|
||||
this.restoreIo = function(piped) {
|
||||
|
@ -113,10 +108,11 @@ Door.prototype.run = function() {
|
|||
}
|
||||
|
||||
const door = pty.spawn(self.exeInfo.cmd, args, {
|
||||
cols : self.client.term.termWidth,
|
||||
rows : self.client.term.termHeight,
|
||||
cols : self.client.term.termWidth,
|
||||
rows : self.client.term.termHeight,
|
||||
// :TODO: cwd
|
||||
env : self.exeInfo.env,
|
||||
env : self.exeInfo.env,
|
||||
encoding : null, // we want to handle all encoding ourself
|
||||
});
|
||||
|
||||
if('stdio' === self.exeInfo.io) {
|
||||
|
|
|
@ -9,7 +9,7 @@ const Log = require('./logger.js').log;
|
|||
const _ = require('lodash');
|
||||
const later = require('later');
|
||||
const path = require('path');
|
||||
const pty = require('ptyw.js');
|
||||
const pty = require('node-pty');
|
||||
const sane = require('sane');
|
||||
const moment = require('moment');
|
||||
const paths = require('path');
|
||||
|
|
|
@ -14,7 +14,7 @@ const Log = require('./logger.js').log;
|
|||
// deps
|
||||
const async = require('async');
|
||||
const _ = require('lodash');
|
||||
const pty = require('ptyw.js');
|
||||
const pty = require('node-pty');
|
||||
const temptmp = require('temptmp').createTrackedSession('transfer_file');
|
||||
const paths = require('path');
|
||||
const fs = require('graceful-fs');
|
||||
|
@ -361,11 +361,14 @@ exports.getModule = class TransferFileModule extends MenuModule {
|
|||
'Executing external protocol'
|
||||
);
|
||||
|
||||
const externalProc = pty.spawn(cmd, args, {
|
||||
cols : this.client.term.termWidth,
|
||||
rows : this.client.term.termHeight,
|
||||
cwd : this.recvDirectory,
|
||||
});
|
||||
const spawnOpts = {
|
||||
cols : this.client.term.termWidth,
|
||||
rows : this.client.term.termHeight,
|
||||
cwd : this.recvDirectory,
|
||||
encoding : null, // don't bork our data!
|
||||
};
|
||||
|
||||
const externalProc = pty.spawn(cmd, args, spawnOpts);
|
||||
|
||||
this.client.setTemporaryDirectDataHandler(data => {
|
||||
// needed for things like sz/rz
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
"minimist": "1.2.x",
|
||||
"moment": "^2.20.1",
|
||||
"nodemailer": "^4.4.1",
|
||||
"ptyw.js": "NuSkooler/ptyw.js",
|
||||
"node-pty": "^0.7.4",
|
||||
"rlogin": "^1.0.0",
|
||||
"sane": "^2.2.0",
|
||||
"sanitize-filename": "^1.6.1",
|
||||
|
|
Loading…
Reference in New Issue