Преглед на файлове

Merge pull request #46215 from thaJeztah/24.0_backport_windows_fix_service_register

[24.0 backport] windows: fix --register-service when executed from within binary directory
Bjorn Neergaard преди 1 година
родител
ревизия
215c6e7aec
променени са 1 файла, в които са добавени 1 реда и са изтрити 10 реда
  1. 1 10
      cmd/dockerd/service_windows.go

+ 1 - 10
cmd/dockerd/service_windows.go

@@ -7,7 +7,6 @@ import (
 	"io"
 	"log"
 	"os"
-	"os/exec"
 	"path/filepath"
 	"time"
 
@@ -145,16 +144,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
 	}