Skip to content

Commit

Permalink
fix nil cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
marwan-at-work committed Jan 7, 2024
1 parent d7026fc commit 8eb996e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion watcher/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ func (w *watcher) watch(ctx context.Context, files []string) error {
case err := <-watcher.Errors:
w.c.Logf("watcher error: %v", err)
case err := <-w.exitChan:
w.cmd = nil
w.c.OnProcessExit(err)
w.c.Logf("process exited unexpectedly: %v", err)
}
Expand Down Expand Up @@ -181,7 +182,7 @@ func (w *watcher) stop(ctx context.Context) error {

// TODO: call cmd.Process.Kill() if need be and/or timeout.
err := w.cmd.Process.Signal(os.Interrupt)
if err != nil {
if err != nil && !errors.Is(err, os.ErrProcessDone) {
return fmt.Errorf("process.Interrupt: %w", err)
}
select {
Expand Down

0 comments on commit 8eb996e

Please sign in to comment.