From 3165c615af96263e15d4b6ec7a3636cfb9829c4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B9ng=20Tr=E1=BA=A7n=20V=C4=83n?= Date: Wed, 17 Jan 2024 09:02:53 +0700 Subject: [PATCH] fix destroy callback never to be called --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 5f95820..c7054eb 100644 --- a/index.js +++ b/index.js @@ -681,7 +681,8 @@ class ModbusRTU extends EventEmitter { // close the serial port if exist and it has a destroy function if (this._port && this._port.destroy) { this._port.removeAllListeners("data"); - this._port.destroy(callback); + this._port.destroy(); + callback(); } else { // nothing needed to be done callback();