Send SIGINT first while killing the container by timeout
This commit is contained in:
parent
b3d4a0dbc2
commit
d972bae547
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user