From 852680e94461edeb1c8c4539b8bf65541e41d56e Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Fri, 26 May 2023 16:57:57 +0000 Subject: [PATCH] feat: remove default timeout --- container/container.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/container/container.go b/container/container.go index 4e3ad00..2aec077 100644 --- a/container/container.go +++ b/container/container.go @@ -29,7 +29,7 @@ var Runtime = "docker" var Registry = "" -var Timeout = 8 * time.Minutes +var Timeout time.Duration var Commands []config.DockerCommand @@ -314,18 +314,20 @@ func (c Container) Run(workdir string, cmds []string) (out string, err error) { } cmd.Stderr = cmd.Stdout - timer := time.AfterFunc(Timeout, func() { - flog.Info().Msg("killing container by timeout") + if Timeout != 0 { + timer := time.AfterFunc(Timeout, func() { + flog.Info().Msg("killing container by timeout") - flog.Debug().Msg("SIGINT") - cmd.Process.Signal(os.Interrupt) + flog.Debug().Msg("SIGINT") + cmd.Process.Signal(os.Interrupt) - time.Sleep(time.Minute) + time.Sleep(time.Minute) - flog.Debug().Msg("SIGKILL") - cmd.Process.Kill() - }) - defer timer.Stop() + flog.Debug().Msg("SIGKILL") + cmd.Process.Kill() + }) + defer timer.Stop() + } err = cmd.Start() if err != nil {