From 57115a8f563002149c62fd4943b8b1d3b871fe58 Mon Sep 17 00:00:00 2001 From: Antonis Kalipetis Date: Mon, 2 Dec 2024 16:55:49 +0200 Subject: [PATCH] Clear PHP and .phar cache on failed execution Lightly resolve issues where PHP binary does not work, especially on Windows --- internal/legacy/legacy.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/legacy/legacy.go b/internal/legacy/legacy.go index 97fadb4..3664cc9 100644 --- a/internal/legacy/legacy.go +++ b/internal/legacy/legacy.go @@ -182,6 +182,9 @@ func (c *CLIWrapper) Exec(ctx context.Context, args ...string) error { c.Version, )) if err := cmd.Run(); err != nil { + // Cleanup cache directory + c.debugLog("removing cache directory: %s", c.cacheDir()) + os.RemoveAll(c.cacheDir()) return fmt.Errorf("could not run legacy CLI command: %w", err) }