Skip to content

Commit

Permalink
Initialize default signals in NewMachine
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Dwan <[email protected]>
  • Loading branch information
michaeldwan committed Jan 6, 2020
1 parent 2bc95ec commit 0ead0ca
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,16 @@ func NewMachine(ctx context.Context, cfg Config, opts ...Opt) (*Machine, error)
cfg.VMID = randomID.String()
}

if cfg.ForwardSignals == nil {
cfg.ForwardSignals = []os.Signal{
os.Interrupt,
syscall.SIGQUIT,
syscall.SIGTERM,
syscall.SIGHUP,
syscall.SIGABRT,
}
}

m.machineConfig = cfg.MachineCfg
m.Cfg = cfg

Expand Down Expand Up @@ -879,16 +889,6 @@ func (m *Machine) waitForSocket(timeout time.Duration, exitchan chan error) erro
func (m *Machine) setupSignals() {
signals := m.Cfg.ForwardSignals

if signals == nil {
signals = []os.Signal{
os.Interrupt,
syscall.SIGQUIT,
syscall.SIGTERM,
syscall.SIGHUP,
syscall.SIGABRT,
}
}

if len(signals) == 0 {
return
}
Expand Down

0 comments on commit 0ead0ca

Please sign in to comment.