From 0e44626c13c71559c5357428d4e3c968fc43acbb Mon Sep 17 00:00:00 2001 From: Tordarus Date: Sat, 28 Jun 2025 13:10:43 +0200 Subject: [PATCH] check instantly if mpv is ready --- commands.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/commands.go b/commands.go index e673f02..a9d5c74 100644 --- a/commands.go +++ b/commands.go @@ -36,6 +36,13 @@ func IsReady(ctx context.Context, socket string) <-chan bool { go func() { defer close(out) + conn, err := net.Dial("unix", socket) + if err == nil { + defer conn.Close() + out <- true + return + } + ticker := time.NewTicker(100 * time.Millisecond) defer ticker.Stop()