branch: elpa/hyperdrive
commit 147cd1e7c6c1894214f5c2e7e989a6c04f6092bb
Author: Joseph Turner <[email protected]>
Commit: Joseph Turner <[email protected]>

    Change: (h//gateway-stop-default) Cancel wait-for-ready timer
    
    If user runs h/stop, the wait-for-ready timer should be canceled to
    avoid displaying the "Gateway failed to start" message after 10 seconds.
---
 hyperdrive-lib.el  | 5 ++++-
 hyperdrive-vars.el | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 6c7165c620..23517a3b8a 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -1474,6 +1474,8 @@ Default function; see variable 
`h/gateway-start-function'."
              do (sleep-for 0.2)))
   (kill-buffer (process-buffer h/gateway-process))
   (setf h/gateway-process nil)
+  (when (timerp h//gateway-starting-timer)
+    (cancel-timer h//gateway-starting-timer))
   (h/message "Gateway stopped."))
 
 (defun h/gateway-live-p ()
@@ -1523,7 +1525,8 @@ Or if gateway isn't ready within timeout, show an error."
                    ;; User appears to have customized the start function: don't
                    ;; show the process buffer.
                    (h/error "Gateway failed to start")))
-                (t (run-at-time 0.1 nil check))))))
+                (t
+                 (setf h//gateway-starting-timer (run-at-time 0.1 nil 
check)))))))
     (funcall check)))
 
 ;;;; Misc.
diff --git a/hyperdrive-vars.el b/hyperdrive-vars.el
index f0c44cfef6..1680d39cd0 100644
--- a/hyperdrive-vars.el
+++ b/hyperdrive-vars.el
@@ -376,6 +376,9 @@ If the version was unexpected,
 (defvar h/install-in-progress-p nil
   "Non-nil while hyperdrive is installing or upgrading the gateway.")
 
+(defvar h//gateway-starting-timer nil
+  "The timer used when the gateway is starting.")
+
 (defvar-local h/current-entry nil
   "Entry for current buffer.")
 (put 'h/current-entry 'permanent-local t)

Reply via email to