-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Calling close()
removes all event listeners (including "error")
#638
Comments
Just hit this as well. Even if I have registered an error event handler, there are no events registered when this: https://github.com/voodootikigod/node-serialport/blob/master/serialport.js#L293 is reached—which means that code is pointless. |
This was referenced Feb 17, 2016
This bananas |
(╯‵Д′)╯彡┻━┻ |
Tracking in #702 |
fixed in 3.0.0 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When a SerialPort is closed by calling
close()
, all event listeners are removed (as per the documentation). This behavior might be undesired.If one calls
write
on a closed serial port connection without passing a callback to thewrite
method, an "error" event is emitted by default. So, callingport.write(buf);
on a closed serial port can cause an "error" event to be emitted without an "error" event handler (even if the user created an "error" event handler before the SerialPort was closed). In this case, the default Node behavior for this is to throw an exception, which could crash the program.The text was updated successfully, but these errors were encountered: