Commit 5b5b27f
committed
iolib: fix different behavior in read function
$ lua
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> file = "/tmp"
> fd, _, code = io.open(file, "r")
> _, _, ecode = fd:read(1)
> print(ecode)
21
>
gopher-lua throws an exception:
read /tmp: is a directory
stack traceback:
[G]: in function 'read'
extra/wrapper.lua:17: in function 'exec'
<string>:1: in main chunk
[G]: ?
This patch results in behavior similar to the vanilla lua
implementation.
Closes #4551 parent da9f439 commit 5b5b27f
2 files changed
+14
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
473 | 483 | | |
474 | 484 | | |
475 | 485 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
| |||
0 commit comments