Repository: incubator-mynewt-newt Updated Branches: refs/heads/master 24a7b8beb -> 9c80937fb
Separate syscalls for unix and windows in unixchild.go Note that this only fixes build errors on windows. ble support is not tested on windows. 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/7408d184 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/7408d184 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/7408d184 Branch: refs/heads/master Commit: 7408d18499855f6ba253d7fe90d1736e0bf85711 Parents: 24a7b8b Author: cwanda <[email protected]> Authored: Mon May 22 11:18:22 2017 -0700 Committer: cwanda <[email protected]> Committed: Mon May 22 11:30:05 2017 -0700 ---------------------------------------------------------------------- util/unixchild/syscall_unix.go | 31 +++++++++++++++++++++++++++++++ util/unixchild/syscall_windows.go | 33 +++++++++++++++++++++++++++++++++ util/unixchild/unixchild.go | 3 +-- 3 files changed, 65 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/7408d184/util/unixchild/syscall_unix.go ---------------------------------------------------------------------- diff --git a/util/unixchild/syscall_unix.go b/util/unixchild/syscall_unix.go new file mode 100644 index 0000000..55510fd --- /dev/null +++ b/util/unixchild/syscall_unix.go @@ -0,0 +1,31 @@ +// +build !windows + +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package unixchild + +import ( + "syscall" +) + +func SetSysProcAttrSetPGID() *syscall.SysProcAttr { + + return &syscall.SysProcAttr{Setpgid: true} +} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/7408d184/util/unixchild/syscall_windows.go ---------------------------------------------------------------------- diff --git a/util/unixchild/syscall_windows.go b/util/unixchild/syscall_windows.go new file mode 100644 index 0000000..33f15c0 --- /dev/null +++ b/util/unixchild/syscall_windows.go @@ -0,0 +1,33 @@ +// +build windows + +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package unixchild + +import ( + "syscall" +) + +func SetSysProcAttrSetPGID() *syscall.SysProcAttr { + + // XXX NOT TESTED + + return &syscall.SysProcAttr{CreationFlags: 0x00000008} +} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/7408d184/util/unixchild/unixchild.go ---------------------------------------------------------------------- diff --git a/util/unixchild/unixchild.go b/util/unixchild/unixchild.go index cb4734d..4c815f3 100644 --- a/util/unixchild/unixchild.go +++ b/util/unixchild/unixchild.go @@ -29,7 +29,6 @@ import ( "os/exec" "strings" "sync" - "syscall" "time" log "github.com/Sirupsen/logrus" @@ -108,7 +107,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} + subProcess.SysProcAttr = SetSysProcAttrSetPGID() stdin, err := subProcess.StdinPipe() if err != nil {
