Skip to content

Commit f090469

Browse files
committed
fix(dev): ensure goroutine completion in file watcher implementation
- Added a call to `wg.Done()` in the goroutine for the file watcher to ensure proper synchronization and prevent potential deadlocks. - Updated the goroutine structure for clarity and correctness in managing concurrent operations.
1 parent 837433b commit f090469

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

cmd/forge/plugins/dev.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,11 @@ func (p *DevPlugin) runWithWatch(ctx cli.CommandContext, app *AppInfo) error {
330330
}
331331

332332
// Watch for file changes
333-
334-
wg.Go(func() {
333+
wg.Add(1)
334+
go func() {
335+
defer wg.Done()
335336
watcher.Watch(watchCtx, ctx)
336-
})
337+
}()
337338

338339
// Wait for interrupt signal
339340
<-sigChan

0 commit comments

Comments
 (0)