Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: Implement Duplex destroy #2831

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

feat: Implement Duplex destroy #2831

wants to merge 2 commits into from

Conversation

rotu
Copy link
Contributor

@rotu rotu commented Jun 21, 2024

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
Copy link
Contributor Author

rotu commented Jun 24, 2024

@reconbot Could you please take a look at this?

@rotu
Copy link
Contributor Author

rotu commented Jul 2, 2024

@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?

@jichu4n
Copy link

jichu4n commented Jul 2, 2024

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

@rotu
Copy link
Contributor Author

rotu commented Aug 16, 2024

for your consideration, @reconbot

@rotu
Copy link
Contributor Author

rotu commented Aug 19, 2024

@HipsterBrown maybe you can help?

@rotu
Copy link
Contributor Author

rotu commented Dec 26, 2024

Rebased

@rotu rotu changed the title Implement Duplex destroy feat: Implement Duplex destroy Feb 28, 2025
@rotu
Copy link
Contributor Author

rotu commented Feb 28, 2025

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants