mirror of https://github.com/status-im/consul.git
agent/proxy: fix build on Windows
This commit is contained in:
parent
070c91cb23
commit
316bdbe010
|
@ -8,7 +8,6 @@ import (
|
|||
"reflect"
|
||||
"strconv"
|
||||
"sync"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/consul/lib/file"
|
||||
|
@ -255,9 +254,9 @@ func (p *Daemon) start() (*os.Process, error) {
|
|||
cmd.Args = []string{cmd.Path}
|
||||
}
|
||||
|
||||
// Start it in a new sessions (and hence process group) so that killing agent
|
||||
// (even with Ctrl-C) won't kill proxy.
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
|
||||
// Perform system-specific setup. In particular, Unix-like systems
|
||||
// shuld set sid so that killing the agent doesn't kill the daemon.
|
||||
configureDaemon(&cmd)
|
||||
|
||||
// Start it
|
||||
p.Logger.Printf("[DEBUG] agent/proxy: starting proxy: %q %#v", cmd.Path, cmd.Args[1:])
|
||||
|
|
|
@ -5,6 +5,7 @@ package proxy
|
|||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
|
@ -28,3 +29,10 @@ func findProcess(pid int) (*os.Process, error) {
|
|||
|
||||
return nil, fmt.Errorf("process %d is dead or running as another user", pid)
|
||||
}
|
||||
|
||||
// configureDaemon is called prior to Start to allow system-specific setup.
|
||||
func configureDaemon(cmd *exec.Cmd) {
|
||||
// Start it in a new sessions (and hence process group) so that killing agent
|
||||
// (even with Ctrl-C) won't kill proxy.
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ package proxy
|
|||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func findProcess(pid int) (*os.Process, error) {
|
||||
|
@ -12,3 +13,7 @@ func findProcess(pid int) (*os.Process, error) {
|
|||
// non-nil means it seems to be healthy.
|
||||
return os.FindProcess(pid)
|
||||
}
|
||||
|
||||
func configureDaemon(cmd *exec.Cmd) {
|
||||
// Do nothing
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue