buzz-lang / Buzz

A programming language designed for robot swarms.
MIT License
294 stars 61 forks source link

bzzparse returns 0 when fails to read included file #98

Closed xgroleau closed 3 years ago

xgroleau commented 3 years ago

When an included file is not found, bzzparse returns 0. Our compilation pipelines still continues even if the compilation failed and we end up with invalid nop only bytecode.

To reproduce:

The in.bzz file

include "invalid_file.bzz"

The shell script

bzzparse in.bzz out.basm # Prints "Can't read 'invalid_file.bzz'"
echo $? # Returns 0, should return a non-zero error code
beltrame commented 3 years ago

Thank you for finding this issue. There are a couple of places where missed a check for a valid include.