File tree 1 file changed +16
-17
lines changed 1 file changed +16
-17
lines changed Original file line number Diff line number Diff line change @@ -226,28 +226,27 @@ func main() {
226
226
signal .Notify (c , syscall .SIGINT )
227
227
signal .Notify (c , syscall .SIGTERM )
228
228
229
- // Launch the command in a go routine
229
+ // Wait for the process to end
230
230
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
+ }
234
241
}
235
- done <- struct {}{}
236
242
}()
237
243
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 )
250
248
}
249
+ done <- struct {}{}
251
250
252
251
log .Debug ("Go back to orignal namspace" )
253
252
You can’t perform that action at this time.
0 commit comments