Skip to content

Commit

Permalink
fix destroy callback never to be called (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
narttmk authored Jan 17, 2024
1 parent 5663cbf commit b49090b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit b49090b

Please sign in to comment.