* Trying to figure out environment issue...
This commit is contained in:
parent
06648403cc
commit
a57f4aadcc
|
@ -555,5 +555,4 @@ function display(options, cb) {
|
|||
|
||||
parser.reset(options.art);
|
||||
parser.parse();
|
||||
//parser.parse(options.art);
|
||||
}
|
|
@ -103,6 +103,7 @@ function MultiLineEditTextView(options) {
|
|||
|
||||
this.textLines = [];
|
||||
this.topVisibleIndex = 0;
|
||||
this.mode = options.mode || 'edit'; // edit | preview
|
||||
|
||||
//
|
||||
// cursorPos represents zero-based row, col positions
|
||||
|
|
|
@ -428,6 +428,7 @@ function TelnetClient(input, output) {
|
|||
this.didReady = false; // have we emit the 'ready' event?
|
||||
|
||||
this.input.on('data', function onData(b) {
|
||||
console.log(b)
|
||||
bufs.push(b);
|
||||
|
||||
var i;
|
||||
|
@ -508,7 +509,7 @@ TelnetClient.prototype.handleWillCommand = function(evt) {
|
|||
// See RFC 1091 @ http://www.faqs.org/rfcs/rfc1091.html
|
||||
//
|
||||
this.requestTerminalType();
|
||||
} else if('environment variables' === evt.option) {
|
||||
} else if('new environment' === evt.option) {
|
||||
//
|
||||
// See RFC 1572 @ http://www.faqs.org/rfcs/rfc1572.html
|
||||
//
|
||||
|
@ -659,25 +660,45 @@ TelnetClient.prototype.requestTerminalType = function() {
|
|||
SB_COMMANDS.SEND,
|
||||
COMMANDS.IAC,
|
||||
COMMANDS.SE ]);
|
||||
return this.output.write(buf);
|
||||
this.output.write(buf);
|
||||
};
|
||||
|
||||
var WANTED_ENVIRONMENT_VARIABLES = [ 'LINES', 'COLUMNS', 'TERM', 'TERM_PROGRAM' ];
|
||||
//var WANTED_ENVIRONMENT_VARIABLES = [ 'LINES', 'COLUMNS', 'TERM', 'TERM_PROGRAM' ];
|
||||
var WANTED_ENVIRONMENT_VAR_BUFS = [
|
||||
new Buffer( 'LINES' ),
|
||||
new Buffer( 'COLUMNS' ),
|
||||
new Buffer( 'TERM' ),
|
||||
new Buffer( 'TERM_PROGRAM' )
|
||||
];
|
||||
|
||||
TelnetClient.prototype.requestEnvironmentVariables = function() {
|
||||
return;
|
||||
// :TODO: This is broken. I think we just need to wait for supress go-ahead/etc. before doing this?
|
||||
|
||||
var self = this;
|
||||
|
||||
console.log('requesting environment...')
|
||||
var bufs = buffers();
|
||||
bufs.push(new Buffer( [
|
||||
COMMANDS.IAC,
|
||||
COMMANDS.SB,
|
||||
OPTIONS.NEW_ENVIRONMENT,
|
||||
SB_COMMANDS.SEND ]
|
||||
));
|
||||
|
||||
bufs.push(new Buffer([ COMMANDS.IAC, COMMANDS.SB, OPTIONS.NEW_ENVIRONMENT, SB_COMMANDS.SEND ]));
|
||||
|
||||
for(var i = 0; i < WANTED_ENVIRONMENT_VARIABLES.length; ++i) {
|
||||
//bufs.push(new Buffer( [ ENVIRONMENT_VARIABLES_COMMANDS.VAR ]));
|
||||
bufs.push(new Buffer( [ NEW_ENVIRONMENT_COMMANDS.VAR ] ));
|
||||
bufs.push(new Buffer(WANTED_ENVIRONMENT_VARIABLES[i])); // :TODO: encoding here?! UTF-8 will work, but shoudl be more explicit
|
||||
for(var i = 0; i < WANTED_ENVIRONMENT_VAR_BUFS.length; ++i) {
|
||||
bufs.push(new Buffer( [ NEW_ENVIRONMENT_COMMANDS.VAR ] ), WANTED_ENVIRONMENT_VAR_BUFS[i] );
|
||||
}
|
||||
|
||||
bufs.push(new Buffer([ COMMANDS.IAC, COMMANDS.SE ]));
|
||||
|
||||
return this.output.write(bufs.toBuffer());
|
||||
var out = bufs.toBuffer();
|
||||
console.log('out=')
|
||||
console.log(out)
|
||||
console.log('---')
|
||||
|
||||
self.output.write(bufs.toBuffer());
|
||||
|
||||
};
|
||||
|
||||
TelnetClient.prototype.banner = function() {
|
||||
|
@ -714,14 +735,14 @@ Object.keys(OPTIONS).forEach(function(name) {
|
|||
buf[1] = this.command;
|
||||
buf[2] = code;
|
||||
return this.client.output.write(buf);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
// Create do, dont, etc. methods on Client
|
||||
['do', 'dont', 'will', 'wont'].forEach(function(command) {
|
||||
function get() {
|
||||
var get = function() {
|
||||
return new Command(command, this);
|
||||
}
|
||||
};
|
||||
|
||||
Object.defineProperty(TelnetClient.prototype, command, {
|
||||
get : get,
|
||||
|
|
Loading…
Reference in New Issue