fix: add newline at the beginning of file buffer when there is shebang

this makes the line count in error messages line up properly
lua5.4
TorchedSammy 2022-04-02 20:59:55 -04:00
parent 8a34783fee
commit e6563fbd8b
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
1 changed files with 2 additions and 1 deletions

View File

@ -71,15 +71,16 @@ func DoFile(rtm *rt.Runtime, path string) error {
return err
}
var buf []byte
if c == byte('#') {
// shebang - skip that line
_, err := reader.ReadBytes('\n')
if err != nil && err != io.EOF {
return err
}
buf = []byte{'\n'}
}
var buf []byte
for {
line, err := reader.ReadBytes('\n')
if err != nil {