Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d4c259f

Browse files
committedFeb 26, 2021
Exit with error when a sketch file is unreadable
When any sketch file that would normally be compiled is unreadable, SketchLoad would previously just silently skip it, leading to potentially unexpected results. It is probably better to just error out and let the user sort out the problem instead. Additionally, this prepares for improving the handling of broken symlinks in the next commit.
1 parent bf364db commit d4c259f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎arduino/builder/sketch.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ func SketchLoad(sketchPath, buildPath string) (*sketch.Sketch, error) {
197197
// check if file is readable
198198
f, err := os.Open(path)
199199
if err != nil {
200-
return nil
200+
feedback.Errorf("Failed to open sketch file: %v", err)
201+
os.Exit(errorcodes.ErrGeneric)
201202
}
202203
f.Close()
203204

0 commit comments

Comments
 (0)
Please sign in to comment.