From d59ba98314e02be939938f682fd67cd68bbb3b68 Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Mon, 26 Sep 2022 09:23:11 +0200 Subject: vm: add the proxyapp support (#3269) * vm: add pool.Close() support * vm: add proxyapp client implementation * vm/proxyapp: autogenerate mocks * vm/proxyapp: add proxyapp tests * pkg/mgrconfig: add proxyapp type tests --- pkg/osutil/osutil.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'pkg/osutil') diff --git a/pkg/osutil/osutil.go b/pkg/osutil/osutil.go index 0194a616e..7eb033652 100644 --- a/pkg/osutil/osutil.go +++ b/pkg/osutil/osutil.go @@ -5,6 +5,7 @@ package osutil import ( "bytes" + "context" "fmt" "io/ioutil" "os" @@ -79,6 +80,14 @@ func Run(timeout time.Duration, cmd *exec.Cmd) ([]byte, error) { return output.Bytes(), nil } +// CommandContext is similar to os/exec.CommandContext, but also sets PDEATHSIG to SIGKILL on linux, +// i.e. the child will be killed immediately. +func CommandContext(ctx context.Context, bin string, args ...string) *exec.Cmd { + cmd := exec.CommandContext(ctx, bin, args...) + setPdeathsig(cmd, true) + return cmd +} + // Command is similar to os/exec.Command, but also sets PDEATHSIG to SIGKILL on linux, // i.e. the child will be killed immediately. func Command(bin string, args ...string) *exec.Cmd { -- cgit mrf-deployment