mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-05 11:24:08 +00:00
Fix IndexDefect in asyncfile.readLine (#22774)
`readLine` proc in asyncfile module caused IndexDefect when it reached EoF. Now it returns empty string instead.
This commit is contained in:
@@ -301,6 +301,8 @@ proc readLine*(f: AsyncFile): Future[string] {.async.} =
|
||||
result = ""
|
||||
while true:
|
||||
var c = await read(f, 1)
|
||||
if c.len == 0:
|
||||
break
|
||||
if c[0] == '\c':
|
||||
c = await read(f, 1)
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user