unixchild - Remove child from parent's pgid. This prevents the child process from receiving a ^C SIGINT.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/24a7b8be Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/24a7b8be Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/24a7b8be Branch: refs/heads/master Commit: 24a7b8beb344f4817b277b778bb51d1ce2bf5a73 Parents: 26b618f Author: Christopher Collins <ccoll...@apache.org> Authored: Thu May 18 16:00:01 2017 -0700 Committer: Christopher Collins <ccoll...@apache.org> Committed: Thu May 18 16:00:01 2017 -0700 ---------------------------------------------------------------------- util/unixchild/unixchild.go | 2 ++ 1 file changed, 2 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/24a7b8be/util/unixchild/unixchild.go ---------------------------------------------------------------------- diff --git a/util/unixchild/unixchild.go b/util/unixchild/unixchild.go index 3474424..cb4734d 100644 --- a/util/unixchild/unixchild.go +++ b/util/unixchild/unixchild.go @@ -29,6 +29,7 @@ import ( "os/exec" "strings" "sync" + "syscall" "time" log "github.com/Sirupsen/logrus" @@ -107,6 +108,7 @@ func New(conf Config) *Client { func (c *Client) startChild() (*exec.Cmd, error) { subProcess := exec.Command(c.childPath, c.childArgs...) + subProcess.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} stdin, err := subProcess.StdinPipe() if err != nil {