Skip to content

Commit bc032f1

Browse files
committed
Ensure prerunner termination
1 parent 9f2c7a1 commit bc032f1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

internal/arduino/builder/internal/detector/detector.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,11 @@ func (l *SketchLibrariesDetector) findIncludes(
288288
}
289289
}
290290
}
291-
defer l.preRunner.Cancel()
291+
defer func() {
292+
if l.preRunner != nil {
293+
l.preRunner.Cancel()
294+
}
295+
}()
292296

293297
l.addIncludeFolder(buildCorePath)
294298
if buildVariantPath != nil {
@@ -430,9 +434,8 @@ func (l *SketchLibrariesDetector) findMissingIncludesInCompilationUnit(
430434

431435
// Stop the pre-runner
432436
if l.preRunner != nil {
433-
preRunner := l.preRunner
437+
l.preRunner.Cancel()
434438
l.preRunner = nil
435-
go preRunner.Cancel()
436439
}
437440

438441
// Run the actual preprocessor

0 commit comments

Comments
 (0)