Skip to content

Commit 04f1647

Browse files
Fail when sketch files cannot be opened during load
Before commit e7d4eaa ([breaking] Refactor codebase to use a single Sketch struct (arduino#1353)), any sketch file that could not be opened would report a fatal error, but the behavior was changed to silently skip such failing files instead. This restores the original behavior and fails to load a sketch of some of the contained files (after filtering on file extension, so this only includes files that are actually intended to be processed), instead of silently excluding the files (which likely produces hard to explain compilation errors later).
1 parent 698ec9b commit 04f1647

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Diff for: arduino/sketch/sketch.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func New(path *paths.Path) (*Sketch, error) {
115115
// Skip files that can't be opened
116116
f, err := p.Open()
117117
if err != nil {
118-
continue
118+
return nil, err
119119
}
120120
f.Close()
121121

Diff for: test/test_compile.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,10 @@ def test_broken_symlink(sketch_name, link_name, target_name, expect_error):
220220
else:
221221
assert result.ok
222222

223-
test_broken_symlink("CompileIntegrationTestSymlinkBrokenIno", "link.ino", "doesnotexist.ino", expect_error=False)
224-
test_broken_symlink("CompileIntegrationTestSymlinkBrokenCpp", "link.cpp", "doesnotexist.cpp", expect_error=False)
225-
test_broken_symlink("CompileIntegrationTestSymlinkBrokenH", "link.h", "doesnotexist.h", expect_error=False)
226-
test_broken_symlink("CompileIntegrationTestSymlinkBrokenJson", "link.json", "doesnotexist.json", expect_error=False)
223+
test_broken_symlink("CompileIntegrationTestSymlinkBrokenIno", "link.ino", "doesnotexist.ino", expect_error=True)
224+
test_broken_symlink("CompileIntegrationTestSymlinkBrokenCpp", "link.cpp", "doesnotexist.cpp", expect_error=True)
225+
test_broken_symlink("CompileIntegrationTestSymlinkBrokenH", "link.h", "doesnotexist.h", expect_error=True)
226+
test_broken_symlink("CompileIntegrationTestSymlinkBrokenJson", "link.json", "doesnotexist.json", expect_error=True)
227227
test_broken_symlink("CompileIntegrationTestSymlinkBrokenXXX", "link.xxx", "doesnotexist.xxx", expect_error=False)
228228

229229

0 commit comments

Comments
 (0)