While closing port using port.close() - error "asyncClose is not defined" is returned and port stays open.
What are possible reasons for this error?
After tracing in debugger I realized that question "What are possible reasons for this error?" is rather rhetoric one. As SerialPort.close calls async function close() in win32.js this function returns asyncClose(fd) at line 63. I cannot find asyncClose() to be defined anywhere. Nevertheless super.close() at line 60 of win32.js makes port closed - I just cannot reopen it while receiving error "Access denied". Possibly I'm doing something not OK - I'll investigate more.
I checked everything I could. Port opens properly, I can read and write without any problems but when attempting to close it shows above mentioned error. Subsequently this port cannot be neither closed ("Port is not open") nor open ("Access denied").
It would be useful to have it working properly for the purpose of releasing the port and passing it to other application running on the same system - right now it's not possible.
Same issue here.
I've just published [email protected] give it a try. We'll get 8 out of beta yet.
Thanks. I'll try new version and let you know the results.
Issue is still present in 8.0.2. Think it's because the following is missing from the top of bindings/lib/win32.js:
const asyncClose = promisify(binding.close)