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

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

[nongnu] elpa/hyperdrive e9d65ea5d2 102/163: Add: (h/cancel-install) Add


From: ELPA Syncer
Subject: [nongnu] elpa/hyperdrive e9d65ea5d2 102/163: Add: (h/cancel-install) Add function to cancel installation
Date: Fri, 31 May 2024 04:00:21 -0400 (EDT)

branch: elpa/hyperdrive
commit e9d65ea5d2095ec6c64ed25b2a920a9f8346c5d2
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>

    Add: (h/cancel-install) Add function to cancel installation
---
 hyperdrive.el | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/hyperdrive.el b/hyperdrive.el
index c118519007..f19100e7b8 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -1327,9 +1327,15 @@ If FORCEP, don't prompt for confirmation before 
downloading."
                    :then (lambda (filename)
                            (check filename sha256 url))
                    :else (lambda (plz-error)
-                           (h/message "Trying next source because downloading 
from URL %S failed: %S"
-                                      url plz-error)
-                           (try))))
+                           (pcase (plz-error-curl-error plz-error)
+                             (`(2 .  ,_)
+                              ;; "Failed to initialize", likely due to
+                              ;; `interrupt-process' in `h/cancel-install'.
+                              (h/message "Canceled install"))
+                             (_  ; Otherwise, display error and try next URL.
+                              (h/message "Trying next source because 
downloading from URL %S failed: %S"
+                                         url plz-error)
+                              (try))))))
            (h/message "Downloading gateway (%s)..."
                       (or (ignore-errors
                             (file-size-human-readable (head-size url)))
@@ -1359,6 +1365,12 @@ If FORCEP, don't prompt for confirmation before 
downloading."
                         "hyperdrive-start"))))
       (try))))
 
+(defun h/cancel-install ()
+  "Stop downloading/installing hyper-gateway-ushin."
+  (interactive)
+  (h/message "Cancelling install")
+  (interrupt-process h/install-in-progress-p))
+
 (defun h/restart ()
   "Restart the gateway."
   (interactive)



reply via email to

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