emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/mpv d7bb3a7082 40/50: Add sleep and timeout to mpv-kill an


From: ELPA Syncer
Subject: [nongnu] elpa/mpv d7bb3a7082 40/50: Add sleep and timeout to mpv-kill and mpv-play
Date: Tue, 28 Dec 2021 00:58:43 -0500 (EST)

branch: elpa/mpv
commit d7bb3a70829203be827505c40f761d197494817b
Author: Johann Klähn <johann@jklaehn.de>
Commit: Johann Klähn <johann@jklaehn.de>

    Add sleep and timeout to mpv-kill and mpv-play
    
    Fixes #4
---
 mpv.el | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/mpv.el b/mpv.el
index b057443711..54d696c34d 100644
--- a/mpv.el
+++ b/mpv.el
@@ -116,8 +116,11 @@ prepended to ARGS."
          (when (file-exists-p socket)
            (with-demoted-errors (delete-file socket)))
          (run-hooks 'mpv-on-exit-hook))))
-    (while (and (mpv-live-p) (not (file-exists-p socket)))
-      (sleep-for 0.05))
+    (with-timeout
+        (0.5 (mpv-kill)
+             (error "Failed to connect to mpv"))
+      (while (not (file-exists-p socket))
+        (sleep-for 0.05)))
     (setq mpv--queue (tq-create
                   (make-network-process :name "mpv-socket"
                                         :family 'local
@@ -230,6 +233,10 @@ See `mpv-start' if you need to pass further arguments and
     (tq-close mpv--queue))
   (when (mpv-live-p)
     (kill-process mpv--process))
+  (with-timeout
+      (0.5 (error "Failed to kill mpv"))
+    (while (mpv-live-p)
+      (sleep-for 0.05)))
   (setq mpv--process nil)
   (setq mpv--queue nil))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]