(const :tag "Unset HISTFILE" t)
(string :tag "Redirect to a file")))
-;;;###tramp-autoload
-(defconst tramp-display-escape-sequence-regexp (rx "\e" (+ (any ";[" digit)) "m")
- "Terminal control escape sequences for display attributes.")
-
-(defconst tramp-device-escape-sequence-regexp (rx "\e" (+ (any "[" digit)) "n")
- "Terminal control escape sequences for device status.")
-
;; ksh on OpenBSD 4.5 requires that $PS1 contains a `#' character for
;; root users. It uses the `$' character for other users. In order
;; to guarantee a proper prompt, we use "#$ " for the prompt.
(unless (tramp-compat-string-search
"color" (tramp-get-connection-property v "ls" ""))
(goto-char (point-min))
- (while (re-search-forward tramp-display-escape-sequence-regexp nil t)
+ (while (re-search-forward ansi-color-control-seq-regexp nil t)
(replace-match "")))
;; Now decode what read if necessary. Stolen from `insert-directory'.
proc timeout
(rx
(| (regexp shell-prompt-pattern) (regexp tramp-shell-prompt-pattern))
+ (? (regexp ansi-color-control-seq-regexp))
eos))
(error
(delete-process proc)
"Check, whether local ssh OPTION is applicable."
;; We don't want to cache it persistently.
(with-tramp-connection-property nil option
+ ;; "ssh -G" is introduced in OpenSSH 6.7.
;; We use a non-existing IP address for check, in order to avoid
;; useless connections, and DNS timeouts.
(zerop
(regexp (rx
(* (not (any "#$\n")))
(literal tramp-end-of-output)
- (? (regexp tramp-device-escape-sequence-regexp))
+ (? (regexp ansi-color-control-seq-regexp))
(? "\r") eol))
;; Sometimes, the commands do not return a newline but a
;; null byte before the shell prompt, for example "git
;; connection initialization; Tramp redefines the prompt afterwards.
(rx (| bol "\r")
(* (not (any "\n#$%>]")))
- (? "#") (any "#$%>]") (* blank)
- ;; Escape characters.
- (* "\e[" (* (any ";" digit)) alpha (* blank)))
+ (? "#") (any "#$%>]") (* blank))
"Regexp to match prompts from remote shell.
Normally, Tramp expects you to configure `shell-prompt-pattern'
correctly, but sometimes it happens that you are connecting to a
"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)
(while todo
(setq item (pop todo)
tramp-process-action-regexp (symbol-value (nth 0 item))
- pattern (format "\\(%s\\)\\'" tramp-process-action-regexp)
+ pattern (rx (group (regexp tramp-process-action-regexp)) eos)
action (nth 1 item))
(tramp-message
vec 5 "Looking for regexp \"%s\" from remote shell" pattern)
(save-match-data
;; Remove color escape sequences from symlink.
(when (stringp (car attr))
- (while (string-match
- tramp-display-escape-sequence-regexp (car attr))
+ (while (string-match ansi-color-control-seq-regexp (car attr))
(setcar attr (replace-match "" nil nil (car attr)))))
;; Convert uid and gid. Use `tramp-unknown-id-integer'
;; as indication of unusable value.
(defvar ange-ftp-make-backup-files)
(defvar tramp-connection-properties)
(defvar tramp-copy-size-limit)
-(defvar tramp-display-escape-sequence-regexp)
(defvar tramp-fuse-remove-hidden-files)
(defvar tramp-fuse-unmount-on-cleanup)
(defvar tramp-inline-compress-start-size)
(if (bufferp destination) destination (current-buffer))
;; "ls" could produce colorized output.
(goto-char (point-min))
- (while (re-search-forward
- tramp-display-escape-sequence-regexp nil t)
+ (while (re-search-forward ansi-color-control-seq-regexp nil t)
(replace-match "" nil nil))
(should
(string-equal (if destination (format "%s\n" fnnd) "")
(if (bufferp destination) destination (current-buffer))
;; "ls" could produce colorized output.
(goto-char (point-min))
- (while (re-search-forward
- tramp-display-escape-sequence-regexp nil t)
+ (while (re-search-forward ansi-color-control-seq-regexp nil t)
(replace-match "" nil nil))
(should
(string-equal
(current-buffer))
;; "ls" could produce colorized output.
(goto-char (point-min))
- (while
- (re-search-forward tramp-display-escape-sequence-regexp nil t)
+ (while (re-search-forward ansi-color-control-seq-regexp nil t)
(replace-match "" nil nil))
(should
(string-equal
;; Send a string to the processes. Use a random order of
;; the buffers. Mix with regular operation.
- (let ((buffers (copy-sequence buffers)))
+ (let ((buffers (copy-sequence buffers))
+ buf)
(while buffers
- (let* ((buf (seq-random-elt buffers))
- (proc (get-buffer-process buf))
- (file (process-get proc 'foo))
- (count (process-get proc 'bar)))
- (tramp--test-message
- "Start action %d %s %s" count buf (current-time-string))
- ;; Regular operation prior process action.
- (dired-uncache file)
- (if (= count 0)
- (should-not (file-attributes file))
- (should (file-attributes file)))
- ;; Send string to process.
- (process-send-string proc (format "%s\n" (buffer-name buf)))
- (while (accept-process-output nil 0))
- (tramp--test-message
- "Continue action %d %s %s" count buf (current-time-string))
- ;; Regular operation post process action.
- (dired-uncache file)
- (if (= count 2)
- (should-not (file-attributes file))
- (should (file-attributes file)))
- (tramp--test-message
- "Stop action %d %s %s" count buf (current-time-string))
- (process-put proc 'bar (1+ count))
- (unless (process-live-p proc)
- (setq buffers (delq buf buffers))))))
+ (setq buf (seq-random-elt buffers))
+ (if-let ((proc (get-buffer-process buf))
+ (file (process-get proc 'foo))
+ (count (process-get proc 'bar)))
+ (progn
+ (tramp--test-message
+ "Start action %d %s %s" count buf (current-time-string))
+ ;; Regular operation prior process action.
+ (dired-uncache file)
+ (if (= count 0)
+ (should-not (file-attributes file))
+ (should (file-attributes file)))
+ ;; Send string to process.
+ (process-send-string proc (format "%s\n" (buffer-name buf)))
+ (while (accept-process-output nil 0))
+ (tramp--test-message
+ "Continue action %d %s %s" count buf (current-time-string))
+ ;; Regular operation post process action.
+ (dired-uncache file)
+ (if (= count 2)
+ (should-not (file-attributes file))
+ (should (file-attributes file)))
+ (tramp--test-message
+ "Stop action %d %s %s" count buf (current-time-string))
+ (process-put proc 'bar (1+ count))
+ (unless (process-live-p proc)
+ (setq buffers (delq buf buffers))))
+ (setq buffers (delq buf buffers)))))
;; Checks. All process output shall exist in the
;; respective buffers. All created files shall be