Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions agent/setupcli/managers/servicemanagers/windowsmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,10 @@ func (m *windowsManager) StartAgent() error {
if exitError, ok := err.(*exec.ExitError); ok {
ec := exitError.ExitCode()
// NET HELPMSG 2182 : The requested service has already been started.
if ec == 2182 {
if ec == 2 {
return nil
}
}
output = strings.ToLower(output)
if strings.Contains(output, "service has already been started") {
// service already running
return nil
}
return fmt.Errorf("windows: failed to start agent with output '%s' and error: %v", output, err)
}
return nil
Expand All @@ -63,16 +58,11 @@ func (m *windowsManager) StopAgent() error {
if err != nil {
if exitError, ok := err.(*exec.ExitError); ok {
ec := exitError.ExitCode()
//NET HELPMSG 3521 : The *** service is not started.
if ec == 3521 {
// NET HELPMSG 3521 : The *** service is not started.
if ec == 2 {
return nil
}
}
output = strings.ToLower(output)
if strings.Contains(output, "service is not started") {
// Service is already stopped
return nil
}
return fmt.Errorf("windows: failed to stop agent with output '%s' and error: %v", output, err)
}
return nil
Expand Down