Skip to content

Commit

Permalink
(#23) When a script did not end with CRLF, the last line was ignored.
Browse files Browse the repository at this point in the history
  • Loading branch information
hymkor committed Feb 14, 2022
1 parent 83b464e commit 3609706
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func DoFileExceptForAtmarkLines(L *lua.LState, fname string) (err error) {
keepComment := false
in := transform.NewTransformer(func() ([]byte, error) {
bin, err := br.ReadBytes('\n')
if err != nil {
if err != nil && err != io.EOF {
fd.Close()
return nil, err
}
Expand All @@ -72,9 +72,9 @@ func DoFileExceptForAtmarkLines(L *lua.LState, fname string) (err error) {

trim := bytes.TrimRight(bin, "\r\n")
keepComment = len(trim) > 0 && bin[len(trim)-1] == '^'
return rc, nil
return rc, err
}
return bin, nil
return bin, err
})

f, err := L.Load(in, fname)
Expand Down

0 comments on commit 3609706

Please sign in to comment.