From 0f3b1b4dd8c33883f449b6be606eb4f317bae560 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Tue, 24 Mar 2026 01:49:36 +0000 Subject: [PATCH] feat: handle ProxySQL cleanup during sandbox deletion --- sandbox/sandbox.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sandbox/sandbox.go b/sandbox/sandbox.go index e951cbb..979c53f 100644 --- a/sandbox/sandbox.go +++ b/sandbox/sandbox.go @@ -1245,6 +1245,13 @@ func RemoveSandbox(sandboxDir, sandbox string, runConcurrently bool) (execList [ } } + // If a proxysql sub-sandbox exists, stop it before removing the directory + proxysqlStop := path.Join(fullPath, "proxysql", "stop") + if _, statErr := os.Stat(proxysqlStop); statErr == nil { + common.CondPrintf("Stopping ProxySQL in %s\n", path.Join(fullPath, "proxysql")) + _, _ = common.RunCmd(proxysqlStop) + } + rmTargets := []string{fullPath, logDirectory} for _, target := range rmTargets { @@ -1359,6 +1366,13 @@ func RemoveCustomSandbox(sandboxDir, sandbox string, runConcurrently, useStop bo } } + // If a proxysql sub-sandbox exists, stop it before removing the directory + proxysqlStop := path.Join(fullPath, "proxysql", "stop") + if _, statErr := os.Stat(proxysqlStop); statErr == nil { + common.CondPrintf("Stopping ProxySQL in %s\n", path.Join(fullPath, "proxysql")) + _, _ = common.RunCmd(proxysqlStop) + } + rmTargets := []string{fullPath, logDirectory} for _, target := range rmTargets {