Skip to content

Commit

Permalink
Merge branch 'master' into fix-xpcall-error-in-error-handler
Browse files Browse the repository at this point in the history
  • Loading branch information
mzki authored Oct 22, 2023
2 parents 6543bc9 + 018eaa0 commit 293e22e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 12 additions & 1 deletion _glua-tests/issues.lua
Original file line number Diff line number Diff line change
Expand Up @@ -468,4 +468,15 @@ function test()
end)
assert(not ok)
end
test()
test()

-- issue #459
function test()
local a, b = io.popen("ls", nil)
assert(a)
assert(b == nil)
local a, b = io.popen("ls", nil, nil)
assert(a)
assert(b == nil)
end
test()
3 changes: 3 additions & 0 deletions iolib.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,9 @@ func ioPopen(L *LState) int {
cmd := L.CheckString(1)
if L.GetTop() == 1 {
L.Push(LString("r"))
} else if L.GetTop() > 1 && (L.Get(2)).Type() == LTNil {
L.SetTop(1)
L.Push(LString("r"))
}
var file *LUserData
var err error
Expand Down

0 comments on commit 293e22e

Please sign in to comment.