Moved TUN device creation to pre-fork
This commit is contained in:
parent
69fe86edf0
commit
88801529fd
6 changed files with 111 additions and 59 deletions
|
|
@ -11,18 +11,9 @@ import (
|
|||
* TODO: Use env variable to spawn in background
|
||||
*/
|
||||
|
||||
func Daemonize() error {
|
||||
func Daemonize(attr *os.ProcAttr) error {
|
||||
argv := []string{os.Args[0], "--foreground"}
|
||||
argv = append(argv, os.Args[1:]...)
|
||||
attr := &os.ProcAttr{
|
||||
Dir: ".",
|
||||
Env: os.Environ(),
|
||||
Files: []*os.File{
|
||||
os.Stdin,
|
||||
nil,
|
||||
nil,
|
||||
},
|
||||
}
|
||||
process, err := os.StartProcess(
|
||||
argv[0],
|
||||
argv,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue