File tree Expand file tree Collapse file tree 1 file changed +16
-17
lines changed Expand file tree Collapse file tree 1 file changed +16
-17
lines changed Original file line number Diff line number Diff line change @@ -226,28 +226,27 @@ func main() {
226226 signal .Notify (c , syscall .SIGINT )
227227 signal .Notify (c , syscall .SIGTERM )
228228
229- // Launch the command in a go routine
229+ // Wait for the process to end
230230 go func () {
231- err = execCmd (command )
232- if err != nil {
233- log .Warn ("Error while running command : " , err )
231+ for {
232+ select {
233+ // If we recieve a signal, we let it flow to the process
234+ case signal := <- c :
235+ log .Debugf ("Got a %s" , signal .String ())
236+ // If the process is done, we exit properly
237+ case <- done :
238+ log .Debugf ("Process exited properly, exiting" )
239+ return
240+ }
234241 }
235- done <- struct {}{}
236242 }()
237243
238- // Wait for the process to end
239- FOR_LOOP:
240- for {
241- select {
242- // If we recieve a signal, we let it flow to the process
243- case signal := <- c :
244- log .Debugf ("Got a %s" , signal .String ())
245- // If the process is done, we exit properly
246- case <- done :
247- log .Debugf ("Process exited properly, exiting" )
248- break FOR_LOOP
249- }
244+ // Launch the command in a go routine
245+ err = execCmd (command )
246+ if err != nil {
247+ log .Warn ("Error while running command : " , err )
250248 }
249+ done <- struct {}{}
251250
252251 log .Debug ("Go back to orignal namspace" )
253252
You can’t perform that action at this time.
0 commit comments