Skip to content

Commit bbeefca

Browse files
authored
Merge pull request #10 from an-prata/locate-bin-for-start
use `exec.LookPath()` to find webby
2 parents 57c10aa + 7b596f1 commit bbeefca

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

daemon/commands.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package daemon
77
import (
88
"net"
99
"os"
10+
"os/exec"
1011
"os/user"
1112
"strconv"
1213
"syscall"
@@ -102,16 +103,24 @@ func StartForkedDaemon(log *logger.Log) {
102103
Sys: &sysproc,
103104
}
104105

106+
bin, err := exec.LookPath(os.Args[0])
107+
108+
if err != nil {
109+
log.LogErr("Could not find webby binary")
110+
}
111+
112+
log.LogInfo("Found webby binary (" + bin + ")...")
105113
log.LogInfo("Starting process...")
106114

107115
proc, err := os.StartProcess(
108-
os.Args[0],
116+
bin,
109117
[]string{os.Args[0], "-" + Daemon},
110118
&attr,
111119
)
112120

113121
if err != nil {
114122
log.LogErr("Failed to start system process")
123+
log.LogErr(err.Error())
115124
return
116125
}
117126

0 commit comments

Comments
 (0)