From 3609706a90bc68d4c147a2fdc7d16556ba120617 Mon Sep 17 00:00:00 2001 From: HAYAMA_Kaoru Date: Mon, 14 Feb 2022 20:43:25 +0900 Subject: [PATCH] (#23) When a script did not end with CRLF, the last line was ignored. --- main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index d3da22e..3ab71dd 100644 --- a/main.go +++ b/main.go @@ -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 } @@ -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)