telnet-client
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -30,2 +30,3 @@ /// <reference types="node" /> | ||
waitfor?: string | RegExp | false; | ||
sendTimeout?: number; | ||
} | ||
@@ -54,3 +55,2 @@ export interface ConnectOptions extends SendOptions { | ||
port?: number; | ||
sendTimeout?: number; | ||
sock?: Socket; | ||
@@ -57,0 +57,0 @@ socketConnectOptions?: SocketConnectOpts; |
@@ -275,6 +275,6 @@ "use strict"; | ||
response += this.decode(data); | ||
if (sendTimer) | ||
clearTimeout(sendTimer); | ||
if (this.opts.waitFor instanceof RegExp) { | ||
if (this.opts.waitFor.test(response)) { | ||
if (sendTimer) | ||
clearTimeout(sendTimer); | ||
this.socket.removeListener('data', sendHandler); | ||
@@ -284,3 +284,3 @@ resolve(response); | ||
} | ||
else | ||
else if (!sendTimer) | ||
resolve(response); | ||
@@ -291,3 +291,3 @@ }; | ||
this.socket.write(data, () => { | ||
if (!this.opts.waitFor || !opts) { | ||
if (!this.opts.sendTimeout) { | ||
sendTimer = setTimeout(() => { | ||
@@ -294,0 +294,0 @@ sendTimer = undefined; |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"main": "./lib/index.js", | ||
@@ -11,0 +11,0 @@ "types": "./lib/index.d.ts", |
@@ -29,3 +29,3 @@ [![GitHub license](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](https://github.com/mkozjak/node-telnet-client/blob/master/LICENSE) | ||
const { Telnet } = require('telnet-client') | ||
const { Telnet } = require('telnet-client'); | ||
@@ -32,0 +32,0 @@ (async function () { |
Sorry, the diff of this file is not supported yet
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
63388