From 01f9b715fdb8717c5799a10b50a5af0de75b12dd Mon Sep 17 00:00:00 2001 From: Awake <80032860+oAwake@users.noreply.github.com> Date: Sat, 27 Jun 2026 22:57:49 +0330 Subject: [PATCH] fix for timeout not working --- run.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/run.go b/run.go index 3f4f6ed..dbe7ebc 100644 --- a/run.go +++ b/run.go @@ -38,6 +38,18 @@ func (c *Client) RunArgsContext(ctx context.Context, sentences []string) (*Reply } if !c.IsAsync() { + done := make(chan struct{}) + + go func() { + select { + case <-ctx.Done(): + _ = c.Close() + case <-done: + } + }() + + defer close(done) + return c.runArgsContextSync() }