Skip to content

Commit d07e42b

Browse files
committed
machine: stop signal goroutine
1 parent e0522fd commit d07e42b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

machine.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,10 @@ func (m *Machine) startVMM(ctx context.Context) error {
385385
syscall.SIGABRT)
386386
m.logger.Debugf("Setting up signal handler")
387387
go func() {
388-
sig := <-sigchan
389-
m.logger.Printf("Caught signal %s", sig)
390-
m.cmd.Process.Signal(sig)
388+
if sig, ok := <-sigchan; ok {
389+
m.logger.Printf("Caught signal %s", sig)
390+
m.cmd.Process.Signal(sig)
391+
}
391392
}()
392393

393394
// Wait for firecracker to initialize:
@@ -407,6 +408,7 @@ func (m *Machine) startVMM(ctx context.Context) error {
407408
}
408409

409410
signal.Stop(sigchan)
411+
close(sigchan)
410412
close(m.exitCh)
411413
}()
412414

0 commit comments

Comments
 (0)