@@ -2,9 +2,7 @@ package common
22
33import (
44 "fmt"
5- "log"
65 "os"
7- "os/user"
86 "path/filepath"
97 "strings"
108
@@ -27,19 +25,14 @@ func (d emptyDaemon) Stop(s service.Service) error {
2725}
2826
2927func NewServiceWithDaemon (daemon service.Interface ) (Service , error ) {
30- user , err := user .Current ()
31- if err != nil {
32- log .Fatalf (err .Error ())
33- }
34-
3528 options := make (service.KeyValue )
3629 options ["Restart" ] = "on-success"
3730 options ["UserService" ] = true
3831 options ["RunAtLoad" ] = true
3932
4033 ex , err := os .Executable ()
4134 if err != nil {
42- panic (err )
35+ return Service {}, tracerr . Wrap (err )
4336 }
4437 exDirPath := filepath .Dir (ex )
4538 executablePath := filepath .Join (exDirPath , "git-auto-sync-daemon" )
@@ -48,11 +41,9 @@ func NewServiceWithDaemon(daemon service.Interface) (Service, error) {
4841 Name : "git-auto-sync-daemon" ,
4942 DisplayName : "Git Auto Sync Daemon" ,
5043 Description : "Background Process for Auto Syncing Git Repos" ,
51- UserName : user .Username ,
5244
5345 Executable : executablePath ,
5446 Dependencies : []string {
55- "Requires=network.target" ,
5647 "After=network-online.target syslog.target" },
5748 Option : options ,
5849 }
0 commit comments