From b49090b3445e4432f688465e3fb3b78d24e04611 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 11:58:47 +0700 Subject: [PATCH] fix destroy callback never to be called (#542) --- 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();