fix: replace all get current path method from "./" to os args

This commit is contained in:
2026-05-11 14:03:00 +08:00
parent 5c748dafcd
commit ebc8ced8dd
4 changed files with 22 additions and 9 deletions
+3 -3
View File
@@ -94,7 +94,7 @@ func syncRunningInstancesToWatchdog() {
func ensureWatchdogProcess() error {
watchdogName, err := getWatchdogBinaryName()
exec.Command("chmod", "+x", filepath.Join(".", "watchdog", watchdogName)).Run()
exec.Command("chmod", "+x", filepath.Join(global.CurrentPath, "watchdog", watchdogName)).Run()
if err != nil {
return err
}
@@ -105,7 +105,7 @@ func ensureWatchdogProcess() error {
}
postLog.Info(fmt.Sprintf("Watchdog process %s is not running, starting it...", watchdogName))
watchdogPath := filepath.Join(".", "watchdog", watchdogName)
watchdogPath := filepath.Join(global.CurrentPath, "watchdog", watchdogName)
if !utils.IsFileExist(watchdogPath) {
return fmt.Errorf("watchdog binary not found: %s", watchdogPath)
}
@@ -136,7 +136,7 @@ func getWatchdogBinaryName() (string, error) {
case "init.d":
return "watchdog_initd", nil
case "windows":
if utils.IsFileExist(filepath.Join(".", "watchdog", "watchdog_windows.exe")) {
if utils.IsFileExist(filepath.Join(global.CurrentPath, "watchdog", "watchdog_windows.exe")) {
return "watchdog_windows.exe", nil
}
return "watchdog_windows", nil