From c9ad0c11d90da13e80eacfc3387d3094bce309ac Mon Sep 17 00:00:00 2001 From: Dayuan Date: Mon, 1 Apr 2024 17:47:19 +0800 Subject: [PATCH] fix: add module ".exe" suffix in Windows (#998) --- pkg/modules/plugin.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/modules/plugin.go b/pkg/modules/plugin.go index 21bb9072..bf03042d 100644 --- a/pkg/modules/plugin.go +++ b/pkg/modules/plugin.go @@ -108,10 +108,13 @@ func buildPluginPath(namespace, resourceType, version string) (string, error) { goArch := runtime.GOARCH name := resourceType + "_" + version p := filepath.Join(prefixPath, namespace, resourceType, version, goOs, goArch, KusionModuleBinaryPrefix+name) + if runtime.GOOS == "windows" && !strings.HasSuffix(p, ".exe") { + p += ".exe" + } _, err = os.Stat(p) if err != nil { if os.IsNotExist(err) { - return "", fmt.Errorf("module dir doesn't exist. %s", p) + return "", fmt.Errorf("module binary doesn't exist. %s", p) } else { return "", err }