aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/osutil
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2022-09-26 09:23:11 +0200
committerGitHub <noreply@github.com>2022-09-26 09:23:11 +0200
commitd59ba98314e02be939938f682fd67cd68bbb3b68 (patch)
tree27a44d1d8315577110c0c9e09fb825a386b6255b /pkg/osutil
parent0042f2b4c00ce1ceeaa44a0147909fe3a6f86c5c (diff)
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
Diffstat (limited to 'pkg/osutil')
-rw-r--r--pkg/osutil/osutil.go9
1 files changed, 9 insertions, 0 deletions
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 {