Skip to content

Commit

Permalink
fix: remove process exit handlers on stop
Browse files Browse the repository at this point in the history
  • Loading branch information
stoprocent committed Feb 24, 2025
1 parent 8800bd9 commit 36272bd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/uart.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class BluetoothHciSocket extends EventEmitter {
this._serialDevice = null;
this._queue = null;
this._parser = null;
process.on('exit', () => this.reset());
this._exitHandler = this.reset.bind(this);
process.on('exit', this._exitHandler);
}

setFilter (filter) {
Expand Down Expand Up @@ -162,6 +163,7 @@ class BluetoothHciSocket extends EventEmitter {
}

stop () {
process.removeListener('exit', this._exitHandler);
if (this._mode !== 'raw' && this._mode !== 'user') {
return;
}
Expand Down Expand Up @@ -195,4 +197,3 @@ class BluetoothHciSocket extends EventEmitter {
}

module.exports = BluetoothHciSocket;

0 comments on commit 36272bd

Please sign in to comment.