proc timeout
(rx
(| (regexp shell-prompt-pattern) (regexp tramp-shell-prompt-pattern))
- (? (regexp ansi-color-control-seq-regexp))
eos))
(error
(delete-process proc)
(tramp-error proc 'file-error "Process `%s' not available, try again" proc))
(with-current-buffer (process-buffer proc)
(let* (;; Initially, `tramp-end-of-output' is "#$ ". There might
- ;; be leading escape sequences, which must be ignored.
- ;; Busyboxes built with the EDITING_ASK_TERMINAL config
- ;; option send also escape sequences, which must be
- ;; ignored.
+ ;; be leading ANSI control escape sequences, which must be
+ ;; ignored. Busyboxes built with the EDITING_ASK_TERMINAL
+ ;; config option send also ANSI control escape sequences,
+ ;; which must be ignored.
(regexp (rx
(* (not (any "#$\n")))
(literal tramp-end-of-output)
(defcustom tramp-terminal-type "dumb"
"Value of TERM environment variable for logging in to remote host.
Because Tramp wants to parse the output of the remote shell, it is easily
-confused by ANSI color escape sequences and suchlike. Often, shell init
+confused by ANSI control escape sequences and suchlike. Often, shell init
files conditionalize this setup based on the TERM environment variable."
:group 'tramp
:type 'string)
"Wait for output from the shell and perform one action.
See `tramp-process-actions' for the format of ACTIONS."
(let ((case-fold-search t)
- (shell-prompt-pattern
- (rx (regexp shell-prompt-pattern)
- (? (regexp ansi-color-control-seq-regexp))))
- (tramp-shell-prompt-pattern
- (rx (regexp tramp-shell-prompt-pattern)
- (? (regexp ansi-color-control-seq-regexp))))
tramp-process-action-regexp
found todo item pattern action)
(while (not found)
;; Reread output once all actions have been performed.
;; Obviously, the output was not complete.
(while (tramp-accept-process-output proc))
+ ;; Remove ANSI control escape sequences.
+ (with-current-buffer (tramp-get-connection-buffer vec)
+ (goto-char (point-min))
+ (while (re-search-forward ansi-color-control-seq-regexp nil t)
+ (replace-match "")))
(setq todo actions)
(while todo
(setq item (pop todo)
(with-tramp-file-property ,vec ,localname "file-attributes"
(when-let ((attr ,attr))
(save-match-data
- ;; Remove color escape sequences from symlink.
+ ;; Remove ANSI control escape sequences from symlink.
(when (stringp (car attr))
(while (string-match ansi-color-control-seq-regexp (car attr))
(setcar attr (replace-match "" nil nil (car attr)))))