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() }