@@ -48,10 +48,11 @@ type executeResult struct {
4848}
4949
5050type executorImpl struct {
51- Config * config.Config
52- progress * progress.Progress
53- service internal.AllServices
54- logger flume.Logger
51+ Config * config.Config
52+ progress * progress.Progress
53+ service internal.AllServices
54+ logger flume.Logger
55+ sigIntChan chan os.Signal
5556}
5657
5758func (e executorImpl ) WithLogger (args ... interface {}) Executor {
@@ -115,6 +116,7 @@ func (e *executorImpl) PushProgressSuccess(key string) {
115116}
116117
117118func (e * executorImpl ) StopProgressLog () {
119+ signal .Stop (e .sigIntChan ) // prevent progress.Stop() from being called multiple times and panicking
118120 e .progress .Stop ()
119121}
120122
@@ -153,18 +155,18 @@ func (e executorImpl) All() internal.AllServices {
153155// NewExecutor creates the default Executor
154156func NewExecutor (cfg * config.Config , svc internal.AllServices , logger flume.Logger ) Executor {
155157 executor := & executorImpl {
156- Config : cfg ,
157- progress : progress .NewProgress (config .GetProgressOutputConfig ()),
158- logger : logger ,
159- service : svc ,
158+ Config : cfg ,
159+ progress : progress .NewProgress (config .GetProgressOutputConfig ()),
160+ logger : logger ,
161+ service : svc ,
162+ sigIntChan : make (chan os.Signal , 1 ),
160163 }
161164 executor .progress .Start ()
162165
163166 // Handle possible interrupts during execution
164- sigintChan := make (chan os.Signal , 1 )
165- signal .Notify (sigintChan , os .Interrupt )
167+ signal .Notify (executor .sigIntChan , os .Interrupt )
166168 go func () {
167- <- sigintChan
169+ <- executor . sigIntChan
168170
169171 // Cancel the app context
170172 cfg .Cancel ()
0 commit comments