telnet-client
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -223,3 +223,3 @@ 'use strict' | ||
} | ||
data += this.ors | ||
@@ -356,31 +356,22 @@ | ||
this.response = this.inputBuffer.split(this.irs) | ||
this.promptSameLine = false | ||
for (let i = 0; i < this.response.length; i++) { | ||
if (utils.search(this.response[i], this.pageSeparator) !== -1) { | ||
this.response[i] = this.response[i].replace(this.pageSeparator, '') | ||
if (this.response[i].length === 0) this.response.splice(i, 1) | ||
let response = this.inputBuffer.split(this.irs) | ||
for (let i = response.length - 1; i >= 0; --i) { | ||
if (utils.search(response[i], this.pageSeparator) !== -1) { | ||
response[i] = response[i].replace(this.pageSeparator, '') | ||
if (response[i].length === 0) | ||
response.splice(i, 1) | ||
} | ||
else if (this.response[i].indexOf(this.shellPrompt) !== -1) | ||
this.promptSameLine = true | ||
} | ||
if (this.echoLines === 1) this.response.shift() | ||
else if (this.echoLines > 1) this.response.splice(0, this.echoLines) | ||
if (this.echoLines === 1) response.shift() | ||
else if (this.echoLines > 1) response.splice(0, this.echoLines) | ||
/* remove prompt */ | ||
if (this.stripShellPrompt) { | ||
if (this.promptSameLine) { | ||
if(this.response[this.response.length - 1]) | ||
this.response[this.response.length - 1] = | ||
this.response[this.response.length - 1].replace(this.shellPrompt, '') | ||
} | ||
else { | ||
this.response.pop() | ||
/* add a blank line so that command output maintains the trailing new line */ | ||
this.response.push('') | ||
} | ||
const idx = response.length - 1; | ||
response[idx] = utils.search(response[idx], this.shellPrompt) > -1 | ||
? response[idx].replace(this.shellPrompt, '') | ||
: ''; | ||
} | ||
this.response = response; | ||
@@ -387,0 +378,0 @@ this.emit('responseready') |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"main": "./lib/index.js", | ||
@@ -11,0 +11,0 @@ "types": "./lib/index.d.ts", |
@@ -1,2 +0,2 @@ | ||
var telnet = process.env.NODETELNETCLIENT_COV | ||
var telnet = process.env.NODETELNETCLIENT_COV | ||
? require('../lib-cov/index') | ||
@@ -21,3 +21,3 @@ : require('../lib/index') | ||
}) | ||
srv.listen(2323, function() { | ||
@@ -40,3 +40,3 @@ callback() | ||
port: 2323, | ||
shellPrompt: /(>|])/, | ||
shellPrompt: /[[<]\w+[>\]]/, | ||
timeout: 1500 | ||
@@ -53,5 +53,5 @@ } | ||
}) | ||
connection.connect(params) | ||
}, | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49642
1081