From d77c4b7c2e5f30f3e73c61de29b6356853eaa5aa Mon Sep 17 00:00:00 2001 From: hulucc Date: Fri, 3 Apr 2026 11:49:18 +0800 Subject: [PATCH] fix: failpoint-toolexec not working on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Windows, the compile command is never detected because `strings.TrimSuffix(goCmd, ".exe")` operates on the full path (e.g. `C:\...\compile.exe` → `C:\...\compile`) instead of the base name. The comparison `goCmdBase == "compile"` always fails. Fix: use `goCmdBase` instead of `goCmd` in TrimSuffix. --- failpoint-toolexec/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/failpoint-toolexec/main.go b/failpoint-toolexec/main.go index ecd5d4a..6f006c3 100644 --- a/failpoint-toolexec/main.go +++ b/failpoint-toolexec/main.go @@ -37,7 +37,7 @@ func main() { goCmd, buildArgs := os.Args[1], os.Args[2:] goCmdBase := filepath.Base(goCmd) if runtime.GOOS == "windows" { - goCmdBase = strings.TrimSuffix(goCmd, ".exe") + goCmdBase = strings.TrimSuffix(goCmdBase, ".exe") } if strings.ToLower(goCmdBase) == "compile" {