TUN-3744: Fix compilation error in windows service

This commit is contained in:
Nuno Diegues 2021-01-13 16:20:41 +00:00
parent 33d9b4027b
commit 01f0d67875
1 changed files with 5 additions and 5 deletions

View File

@ -165,22 +165,22 @@ func (s *windowsService) Execute(serviceArgs []string, r <-chan svc.ChangeReques
}
func installWindowsService(c *cli.Context) error {
log := logger.CreateLoggerFromContext(c, logger.EnableTerminalLog)
zeroLogger := logger.CreateLoggerFromContext(c, logger.EnableTerminalLog)
log.Info().Msg("Installing Argo Tunnel Windows service")
zeroLogger.Info().Msg("Installing Argo Tunnel Windows service")
exepath, err := os.Executable()
if err != nil {
log.Err(err).Msg("Cannot find path name that start the process")
zeroLogger.Err(err).Msg("Cannot find path name that start the process")
return err
}
m, err := mgr.Connect()
if err != nil {
log.Err(err).Msg("Cannot establish a connection to the service control manager")
zeroLogger.Err(err).Msg("Cannot establish a connection to the service control manager")
return err
}
defer m.Disconnect()
s, err := m.OpenService(windowsServiceName)
log = log.With().Str(LogFieldWindowsServiceName, windowsServiceName).Logger()
log := zeroLogger.With().Str(LogFieldWindowsServiceName, windowsServiceName).Logger()
if err == nil {
s.Close()
log.Err(err).Msg("service already exists")