Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Destroy function callback never to be called #541

Closed
narttmk opened this issue Jan 16, 2024 · 4 comments
Closed

Destroy function callback never to be called #541

narttmk opened this issue Jan 16, 2024 · 4 comments
Labels

Comments

@narttmk
Copy link
Contributor

narttmk commented Jan 16, 2024

image
this._port.destroy function is received an Error instance, so in this case callback never to be called

@narttmk narttmk changed the title Destroy function callback is never called Destroy function callback never to be called Jan 16, 2024
@yaacov
Copy link
Owner

yaacov commented Jan 16, 2024

Hi, thank you for the issue.

Q. does the callback get called ?

Can you investigate the reason for this issue, and suggest a fix ?

Ref:
https://github.com/yaacov/node-modbus-serial/blob/master/index.js#L684

@yaacov yaacov added the bug label Jan 16, 2024
@narttmk
Copy link
Contributor Author

narttmk commented Jan 16, 2024

Hi yaacov,
A: callback does not get called.
Because SerialPortStream extend stream.Duplex
Ref:
https://github.com/serialport/node-serialport/blob/main/packages/stream/lib/index.ts#L70
https://nodejs.org/api/stream.html#class-streamduplex

So the arg push into destroy function should be array of Error.
I suggest that we should move callback to next line below destroy
image

@yaacov
Copy link
Owner

yaacov commented Jan 16, 2024

nice, can you make a pull request ?

@narttmk
Copy link
Contributor Author

narttmk commented Jan 17, 2024

Sure, I created a PR, please help me to review and merge it
#542

@narttmk narttmk closed this as completed Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants