* Temporary work around for broken pty/iconv-lite encoding with doors

This commit is contained in:
Bryan Ashby 2015-11-26 21:27:57 -07:00
parent 15cf37c55c
commit c7a6e6fd29
3 changed files with 14 additions and 8 deletions

View File

@ -6,6 +6,7 @@ var events = require('events');
var _ = require('lodash'); var _ = require('lodash');
var pty = require('ptyw.js'); var pty = require('ptyw.js');
var decode = require('iconv-lite').decode;
exports.Door = Door; exports.Door = Door;
@ -38,6 +39,7 @@ Door.prototype.run = function() {
rows : self.client.term.termHeight, rows : self.client.term.termHeight,
// :TODO: cwd // :TODO: cwd
env : self.exeInfo.env, env : self.exeInfo.env,
//encoding : self.client.term.outputEncoding,
}); });
// :TODO: can we pause the stream, write our own "Loading...", then on resume? // :TODO: can we pause the stream, write our own "Loading...", then on resume?
@ -48,10 +50,11 @@ Door.prototype.run = function() {
// :TODO: do this with pluggable pipe/filter classes // :TODO: do this with pluggable pipe/filter classes
// :TODO: This causes an error to be thrown when e.g. 'cp437' is used due to Node buffer changes // :TODO: This causes an error to be thrown when e.g. 'cp437' is used due to Node buffer changes
door.setEncoding(this.exeInfo.encoding); //door.setEncoding(this.exeInfo.encoding);
door.on('data', function doorData(data) { door.on('data', function doorData(data) {
self.client.term.write(data); self.client.term.write(decode(data, self.client.term.outputEncoding));
}); });
door.on('close', function closed() { door.on('close', function closed() {

View File

@ -140,10 +140,13 @@ function AbracadabraModule(options) {
args : this.config.args, args : this.config.args,
}; };
// :TODO: this system should probably be generic
for(var i = 0; i < exeInfo.args.length; ++i) { for(var i = 0; i < exeInfo.args.length; ++i) {
exeInfo.args[i] = exeInfo.args[i].replace(/\{dropfile\}/g, self.dropFile.fileName); exeInfo.args[i] = exeInfo.args[i].format( {
exeInfo.args[i] = exeInfo.args[i].replace(/\{node\}/g, self.client.node.toString()); dropFile : self.dropFile.fileName,
node : self.client.node.toString(),
socket : self.client.output._handle.fd.toString(), // ugg!
});
} }
var doorInstance = new door.Door(this.client, exeInfo); var doorInstance = new door.Door(this.client, exeInfo);

View File

@ -617,7 +617,7 @@
} }
/* /*
The 'abracadabra' module's config.args accepts the following format objects: The 'abracadabra' module's config.args accepts the following format objects:
{dropfile} - Path to generated dropfile {dropFile} - Path to generated dropfile
{node} - Node number {node} - Node number
*/ */
doorPimpWars: { doorPimpWars: {
@ -628,7 +628,7 @@
dropFileType: DORINFO dropFileType: DORINFO
cmd: /usr/bin/dosemu cmd: /usr/bin/dosemu
args: [ args: [
"-quiet", "-f", "/home/nuskooler/DOS/X/LORD/dosemu.conf", "X:\\PW\\START.BAT {dropfile} {node}" "-quiet", "-f", "/home/nuskooler/DOS/X/LORD/dosemu.conf", "X:\\PW\\START.BAT {dropFile} {node}"
], ],
nodeMax: 1 nodeMax: 1
tooManyArt: DOORMANY tooManyArt: DOORMANY