Return after encountering errors in windows write

The unix version breaks the while loop by returning on certain errors.
On Windows, the errors were being contained because the while loop was
never breaking. For example, pulling the USB cable out would raise
“Access Denied” errors but the while loop would run forever and contain
that error.
This commit is contained in:
Paul Kaplan 2015-11-24 12:42:09 -06:00 • committed by Francis Gulotta
parent 59f281f136
commit 6d2e4b5fa7

View file

@ -378,6 +378,7 @@ void EIO_Write(uv_work_t* req) {
if(lastError != ERROR_IO_PENDING) {
// Write operation error
ErrorCodeToString("Writing to COM port (WriteFile)", lastError, data->errorString);
return;
}
else {
// Write operation is asynchronous and is pending
@ -390,6 +391,7 @@ void EIO_Write(uv_work_t* req) {
// Write operation error
DWORD lastError = GetLastError();
ErrorCodeToString("Writing to COM port (GetOverlappedResult)", lastError, data->errorString);
return;
}
else {
// Write operation completed asynchronously