1
0
Fork 0

Send SIGINT first while killing the container by timeout

timestamps
dump_stack() 2023-04-08 14:50:18 +00:00
parent b3d4a0dbc2
commit d972bae547
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC
1 changed files with 7 additions and 0 deletions

View File

@ -222,6 +222,13 @@ func (c container) Run(workdir string, command string) (output string, err error
timer := time.AfterFunc(c.timeout, func() {
flog.Info().Msg("killing container by timeout")
flog.Debug().Msg("SIGINT")
cmd.Process.Signal(os.Interrupt)
time.Sleep(time.Minute)
flog.Debug().Msg("SIGKILL")
cmd.Process.Kill()
})
defer timer.Stop()