123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- // +build windows
- package zdaemon
- import (
- "fmt"
- "os"
- "syscall"
- )
- func (zd *ZDaemon) makeIPCDir() {
- }
- func (zd *ZDaemon) cleanIPCUnixSock() {
- }
- func (zd *ZDaemon) start() {
- if zd.checkRunning() {
- fmt.Println("Already running. If you think it is dead, using 'restart' instead.")
- return
- }
- sa := &syscall.SysProcAttr{
- HideWindow: true,
- CmdLine: fmt.Sprintf("%s __run__", os.Args[0]),
- CreationFlags: 0,
- Token: 0,
- ProcessAttributes: nil,
- ThreadAttributes: nil,
- }
- p, err := os.StartProcess(os.Args[0], []string{"__run__"}, &os.ProcAttr{
- Dir: zd.programPath,
- Env: os.Environ(),
- Files: []*os.File{
- zd.programStdin,
- zd.programStdout,
- zd.programStderr,
- },
- Sys: sa,
- })
- if err != nil {
- fmt.Println("Failed start: ", err.Error())
- } else {
- fmt.Println("Daemon", zd.daemonName, "started. PID=", p.Pid)
- }
- }
|