Skip to content

Commit e386ea6

Browse files
committed
Only add the daemon dependencies on linux
They seem to be causing problems in Windows according to #7 (comment) Plus they are ignored in osx anyway.
1 parent 7a16e4c commit e386ea6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

common/service.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"os"
66
"path/filepath"
7+
"runtime"
78
"strings"
89

910
"github.com/kardianos/service"
@@ -37,15 +38,19 @@ func NewServiceWithDaemon(daemon service.Interface) (Service, error) {
3738
exDirPath := filepath.Dir(ex)
3839
executablePath := filepath.Join(exDirPath, "git-auto-sync-daemon")
3940

41+
deps := []string{}
42+
if runtime.GOOS == "linux" {
43+
deps = []string{"After=network-online.target syslog.target"}
44+
}
45+
4046
svcConfig := &service.Config{
4147
Name: "git-auto-sync-daemon",
4248
DisplayName: "Git Auto Sync Daemon",
4349
Description: "Background Process for Auto Syncing Git Repos",
4450

45-
Executable: executablePath,
46-
Dependencies: []string{
47-
"After=network-online.target syslog.target"},
48-
Option: options,
51+
Executable: executablePath,
52+
Dependencies: deps,
53+
Option: options,
4954
}
5055

5156
s, err := service.New(daemon, svcConfig)

0 commit comments

Comments
 (0)