Function: eca--curl-download-file
eca--curl-download-file is a natively compiled function defined in
eca-process.el.
Signature
(eca--curl-download-file &key URL PATH ON-DONE ON-ERROR)
Documentation
Downloads a file from URL to PATH shelling out to system with curl.
Retries transient failures eca-server-fetch-retries times, bounding
the connection phase by eca-server-fetch-timeout seconds.
Calls ON-DONE when done. On failure calls ON-ERROR with the error
when provided, otherwise signals it.
Source Code
;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-process.el
(cl-defun eca--curl-download-file (&key url path on-done on-error)
"Downloads a file from URL to PATH shelling out to system with curl.
Retries transient failures `eca-server-fetch-retries' times, bounding
the connection phase by `eca-server-fetch-timeout' seconds.
Calls ON-DONE when done. On failure calls ON-ERROR with the error
when provided, otherwise signals it."
(condition-case err
(let ((curl-cmd (or (executable-find "curl")
(executable-find "curl.exe"))))
(unless curl-cmd
(error "Curl not found. Please install curl or customize eca-custom-command"))
(let ((exit-code (shell-command (format "%s -L -s -S -f --connect-timeout %d --retry %d -o %s %s"
(shell-quote-argument curl-cmd)
eca-server-fetch-timeout
eca-server-fetch-retries
(shell-quote-argument path)
(shell-quote-argument url)))))
(unless (= exit-code 0)
(error "Curl failed with exit code %d" exit-code)))
(funcall on-done))
(error (if on-error
(funcall on-error err)
(signal (car err) (cdr err))))))