MCPcopy
hub / github.com/slimtoolkit/slim / Run

Method Run

pkg/app/sensor/standalone/standalone.go:65–98  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63}
64
65func (s *Sensor) Run() error {
66 s.exe.HookSensorPostStart()
67
68 err := s.run()
69 if err != nil {
70 s.exe.PubEvent(event.Error, err.Error())
71 }
72
73 // We have to dump the artifacts before invokin the pre-shutdown
74 // hook - it may want to upload the artifacts somewhere.
75 errutil.WarnOn(s.artifactor.Archive())
76
77 s.exe.HookSensorPreShutdown()
78 s.exe.PubEvent(event.ShutdownSensorDone)
79
80 // The target app can be done before the stop signal is received
81 // because of two reasons:
82 //
83 // - App terminated on its own (e.g., a typical CLI use case)
84 //
85 // - The "stop monitor" control command was received.
86 //
87 // In the latter case, sensor needs to wait for the stop signal
88 // before proceeding with the shutdown because otherwise the container
89 // runtime may restart the container which is not desirable.
90 if s.stopCommandReceived {
91 select {
92 case <-s.ctx.Done():
93 case <-s.signalCh:
94 }
95 }
96
97 return err
98}
99
100func (s *Sensor) run() error {
101 raw := <-s.exe.Commands()

Callers

nothing calls this directly

Calls 8

runMethod · 0.95
WarnOnFunction · 0.92
HookSensorPostStartMethod · 0.65
PubEventMethod · 0.65
ArchiveMethod · 0.65
HookSensorPreShutdownMethod · 0.65
DoneMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected