Merge pull request #46217 from thaJeztah/20.10_backport_windows_fix_service_register

[20.10 backport] windows: fix --register-service when executed from within binary directory
This commit is contained in:
Cory Snider 2023-08-30 17:43:39 -04:00 committed by GitHub
commit fdb9c710a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,7 +7,6 @@ import (
"io"
"log"
"os"
"os/exec"
"path/filepath"
"time"
"unsafe"
@ -148,16 +147,8 @@ func (h *etwHook) Fire(e *logrus.Entry) error {
return windows.ReportEvent(h.log.Handle, etype, 0, eid, 0, count, 0, &ss[0], nil)
}
func getServicePath() (string, error) {
p, err := exec.LookPath(os.Args[0])
if err != nil {
return "", err
}
return filepath.Abs(p)
}
func registerService() error {
p, err := getServicePath()
p, err := os.Executable()
if err != nil {
return err
}