MCPcopy
hub / github.com/cortesi/modd / Restart

Method Restart

daemon.go:76–95  ·  view source on GitHub ↗

Restart the daemon, or start it if it's not yet running

()

Source from the content-addressed store, hash-verified

74
75// Restart the daemon, or start it if it's not yet running
76func (d *daemon) Restart() {
77 d.Lock()
78 defer d.Unlock()
79 if d.ex == nil {
80 ex, err := shell.NewExecutor(d.shell, d.conf.Command, d.indir)
81 if err != nil {
82 d.log.Shout("Could not create executor: %s", err)
83 }
84 d.ex = ex
85 go d.Run()
86 } else {
87 d.log.Notice(">> sending signal %s", d.conf.RestartSignal)
88 err := d.ex.Signal(d.conf.RestartSignal)
89 if err != nil {
90 d.log.Warn(
91 "failed to send %s signal to %s: %v", d.conf.RestartSignal, d.conf.Command, err,
92 )
93 }
94 }
95}
96
97func (d *daemon) Shutdown(sig os.Signal) error {
98 d.log.Notice(">> stopping")

Callers 2

RestartMethod · 0.45
runBlockMethod · 0.45

Calls 2

RunMethod · 0.95
SignalMethod · 0.80

Tested by

no test coverage detected