Fix error handler.

This commit is contained in:
cheatfate 2020-09-30 11:21:31 +03:00
parent 70405da672
commit cb44a0db40
No known key found for this signature in database
GPG Key ID: 46ADD633A7201F95
1 changed files with 2 additions and 1 deletions

View File

@ -305,8 +305,9 @@ elif defined(posix):
let res = read(STDIN_FILENO, cast[pointer](addr buffer[0]),
len(buffer))
if res < 0:
let errCode = ioLastError()
discard tcSetAttr(STDIN_FILENO, TCSADRAIN, addr(old))
return err(ioLastError())
return err(errCode)
if tcSetAttr(STDIN_FILENO, TCSADRAIN, addr(old)) != cint(0):
return err(ioLastError())