From 61d25c01c13bf3ba45b729faad4218c3a416ef00 Mon Sep 17 00:00:00 2001 From: "Andrew D.Laptev" Date: Mon, 22 Nov 2021 13:01:26 +0300 Subject: [PATCH] Some fixes for tests --- lib/yapople.js | 6 ++++-- package.json | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/yapople.js b/lib/yapople.js index 1fb1d7c..bcba26f 100644 --- a/lib/yapople.js +++ b/lib/yapople.js @@ -98,7 +98,7 @@ function onData(data) { if (sData.substr(0, 3) === '+OK') { succ = sData.substring(4, sData.indexOf('\r\n')); } else { - err = new Error(sData); + err = new Error(sData.substring(5, sData.indexOf('\r\n'))); } // RETR, LIST and TOP are multiline commands if ( @@ -134,7 +134,9 @@ function onData(data) { if (this._command.callback) { this._command.callback.call(this, null); } - this._socket.destroy(); // socket connection close + if (this._socket.destroy) { + this._socket.destroy(); // socket connection close + } }.bind(this)); } else { if (this._command.cmd === state.PASS && !err) { diff --git a/package.json b/package.json index b7806a3..7c0ab94 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yapople", - "version": "0.4.6", + "version": "0.4.7", "author": "Andrew D.Laptev ", "description": "Yet another POP3 library", "main": "lib/yapople.js",