From c4d43f47732557a32357a36d6c4276707e5994b1 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 16 Nov 2017 12:42:30 +0100 Subject: pkg/osutil: don't leace runaway processes When manager is stopped there are sometimes runaway qemu processes still running. Set PDEATHSIG for all subprocesses. We never need child processes outliving parents. --- pkg/git/git.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'pkg/git/git.go') diff --git a/pkg/git/git.go b/pkg/git/git.go index 0178a3004..e4a54f71d 100644 --- a/pkg/git/git.go +++ b/pkg/git/git.go @@ -8,7 +8,6 @@ import ( "bytes" "fmt" "os" - "os/exec" "regexp" "strings" "time" @@ -154,13 +153,13 @@ var commitPrefixes = []string{ func Patch(dir string, patch []byte) error { // Do --dry-run first to not mess with partially consistent state. - cmd := exec.Command("patch", "-p1", "--force", "--ignore-whitespace", "--dry-run") + cmd := osutil.Command("patch", "-p1", "--force", "--ignore-whitespace", "--dry-run") cmd.Stdin = bytes.NewReader(patch) cmd.Dir = dir if output, err := cmd.CombinedOutput(); err != nil { // If it reverses clean, then it's already applied // (seems to be the easiest way to detect it). - cmd = exec.Command("patch", "-p1", "--force", "--ignore-whitespace", "--reverse", "--dry-run") + cmd = osutil.Command("patch", "-p1", "--force", "--ignore-whitespace", "--reverse", "--dry-run") cmd.Stdin = bytes.NewReader(patch) cmd.Dir = dir if _, err := cmd.CombinedOutput(); err == nil { @@ -169,7 +168,7 @@ func Patch(dir string, patch []byte) error { return fmt.Errorf("failed to apply patch:\n%s", output) } // Now apply for real. - cmd = exec.Command("patch", "-p1", "--force", "--ignore-whitespace") + cmd = osutil.Command("patch", "-p1", "--force", "--ignore-whitespace") cmd.Stdin = bytes.NewReader(patch) cmd.Dir = dir if output, err := cmd.CombinedOutput(); err != nil { -- cgit mrf-deployment