diff options
| author | Michael Albinus | 2024-05-30 10:44:30 +0200 |
|---|---|---|
| committer | Michael Albinus | 2024-05-30 10:44:30 +0200 |
| commit | c166abe897bcc2d6e1f59283cf25aef9d47e0c9f (patch) | |
| tree | a2c3d1ad9dbe0416a62838e361a1c4bd1e4a6612 | |
| parent | 9ca7632c5c0c8a8d4c1eb39a82d6c59bea848898 (diff) | |
| download | emacs-c166abe897bcc2d6e1f59283cf25aef9d47e0c9f.tar.gz emacs-c166abe897bcc2d6e1f59283cf25aef9d47e0c9f.zip | |
Improve Tramp error handling
* lisp/net/tramp-container.el (tramp-container-no-container-regexp):
New defcustom.
(tramp-actions-before-shell, tramp-actions-copy-out-of-band): Declare.
Add `tramp-container-no-container-regexp'. (Bug#71200)
| -rw-r--r-- | lisp/net/tramp-container.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lisp/net/tramp-container.el b/lisp/net/tramp-container.el index cc1d9f457cc..e456c51045f 100644 --- a/lisp/net/tramp-container.el +++ b/lisp/net/tramp-container.el | |||
| @@ -117,6 +117,21 @@ | |||
| 117 | ;;; Code: | 117 | ;;; Code: |
| 118 | 118 | ||
| 119 | (require 'tramp) | 119 | (require 'tramp) |
| 120 | (defvar tramp-actions-before-shell) | ||
| 121 | (defvar tramp-actions-copy-out-of-band) | ||
| 122 | |||
| 123 | ;; This does not match all container-based methods. Both in general, | ||
| 124 | ;; the command returns with an error; `tramp-process-alive-regexp' | ||
| 125 | ;; does the check then. | ||
| 126 | (defcustom tramp-container-no-container-regexp | ||
| 127 | (rx bol "Error:" (1+ nonl) "no such container" (0+ nonl) | ||
| 128 | ;; Distrobox adds an interactive prompt. | ||
| 129 | (* "\n" (1+ nonl))) | ||
| 130 | "Regexp matching missing container message. | ||
| 131 | The regexp should match at end of buffer." | ||
| 132 | :group 'tramp | ||
| 133 | :version "30.1" | ||
| 134 | :type 'regexp) | ||
| 120 | 135 | ||
| 121 | ;;;###tramp-autoload | 136 | ;;;###tramp-autoload |
| 122 | (defcustom tramp-docker-program "docker" | 137 | (defcustom tramp-docker-program "docker" |
| @@ -620,6 +635,14 @@ see its function help for a description of the format." | |||
| 620 | `(:application tramp :protocol ,tramp-kubernetes-method) | 635 | `(:application tramp :protocol ,tramp-kubernetes-method) |
| 621 | 'tramp-kubernetes-connection-local-default-profile)) | 636 | 'tramp-kubernetes-connection-local-default-profile)) |
| 622 | 637 | ||
| 638 | (add-to-list | ||
| 639 | 'tramp-actions-before-shell | ||
| 640 | '(tramp-container-no-container-regexp tramp-action-permission-denied)) | ||
| 641 | |||
| 642 | (add-to-list | ||
| 643 | 'tramp-actions-copy-out-of-band | ||
| 644 | '(tramp-container-no-container-regexp tramp-action-permission-denied)) | ||
| 645 | |||
| 623 | ;;;###tramp-autoload | 646 | ;;;###tramp-autoload |
| 624 | (defun tramp-enable-toolbox-method () | 647 | (defun tramp-enable-toolbox-method () |
| 625 | "Enable connection to Toolbox containers." | 648 | "Enable connection to Toolbox containers." |