node-serialport icon indicating copy to clipboard operation
node-serialport copied to clipboard

feat: Implement Duplex destroy

Open rotu opened this issue 1 year ago • 7 comments

Previously, there was no way to close a port reliably with this API. If you open a port, trying to .close before it's done opening would throw an error and leave the underlying port open. If you used node's .destroy(), stream.addAbortSignal(), or [Symbol.asyncDispose], the underlying port would remain in an open state.

This change implements the Duplex.destroy method. This is different from .close in that once a SerialPortStream is destroyed, it cannot be opened again.

rotu avatar Jun 21 '24 21:06 rotu

@reconbot Could you please take a look at this?

rotu avatar Jun 24 '24 16:06 rotu

@reconbot, could you please let me know if this PR is in the right direction? Or if there's some other intended way to clean up a SerialPort object?

rotu avatar Jul 02 '24 18:07 rotu

+1 - would also like to see this fix (or similar) merged, as the current behavior in #2776 is quite tricky to work around.

jichu4n avatar Jul 02 '24 18:07 jichu4n

for your consideration, @reconbot

rotu avatar Aug 16 '24 18:08 rotu

@HipsterBrown maybe you can help?

rotu avatar Aug 19 '24 16:08 rotu

Rebased

rotu avatar Dec 26 '24 17:12 rotu

@reconbot I think this PR is production-ready. If not, could you please let me know what I need to do?

rotu avatar Feb 28 '25 18:02 rotu