1
0

Send SIGINT first while killing the container by timeout

This commit is contained in:
dump_stack() 2023-04-08 14:50:18 +00:00
parent b3d4a0dbc2
commit d972bae547
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC

View File

@ -222,6 +222,13 @@ func (c container) Run(workdir string, command string) (output string, err error
timer := time.AfterFunc(c.timeout, func() { timer := time.AfterFunc(c.timeout, func() {
flog.Info().Msg("killing container by timeout") 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() cmd.Process.Kill()
}) })
defer timer.Stop() defer timer.Stop()