aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus <[email protected]>2007-11-19 20:04:51 +0000
committerMichael Albinus <[email protected]>2007-11-19 20:04:51 +0000
commit8950769ab60b83a1d572681ebe3e74e0c07cd62d (patch)
treede40b139c29516f2915f7beb09746dca5f505253
parentcef8032b091b905df0313757cef93499a25e4cff (diff)
* net/tramp.el (tramp-open-connection-setup-interactive-shell):
Still some tuning in case of an echoing shell. (tramp-send-command): Connection property "remote-echo" is not persistent; cache key is the process therefore.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/net/tramp.el73
2 files changed, 42 insertions, 38 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a567708602..2aa2ba6575 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2007-11-19 Michael Albinus <[email protected]>
+
+ * net/tramp.el (tramp-open-connection-setup-interactive-shell):
+ Still some tuning in case of an echoing shell.
+ (tramp-send-command): Connection property "remote-echo" is not
+ persistent; cache key is the process therefore.
+
2007-11-19 Juanma Barranquero <[email protected]>
* replace.el (map-query-replace-regexp): Doc fix (revert part of
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 83e2e9bf68..ad80f11b8a 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -5619,31 +5619,49 @@ seconds. If not, it produces an error message with the given ERROR-ARGS."
"Set up an interactive shell.
Mainly sets the prompt and the echo correctly. PROC is the shell
process to set up. VEC specifies the connection."
- ;; It is useful to set the prompt in the following command because
- ;; some people have a setting for $PS1 which /bin/sh doesn't know
- ;; about and thus /bin/sh will display a strange prompt. For
- ;; example, if $PS1 has "${CWD}" in the value, then ksh will display
- ;; the current working directory but /bin/sh will display a dollar
- ;; sign. The following command line sets $PS1 to a sane value, and
- ;; works under Bourne-ish shells as well as csh-like shells. Daniel
- ;; Pittman reports that the unusual positioning of the single quotes
- ;; makes it work under `rc', too. We also unset the variable $ENV
- ;; because that is read by some sh implementations (eg, bash when
- ;; called as sh) on startup; this way, we avoid the startup file
- ;; clobbering $PS1. $PROMP_COMMAND is another way to set the prompt
- ;; in /bin/bash, it must be discarded as well.
(let ((tramp-end-of-output "$ "))
+ ;; It is useful to set the prompt in the following command because
+ ;; some people have a setting for $PS1 which /bin/sh doesn't know
+ ;; about and thus /bin/sh will display a strange prompt. For
+ ;; example, if $PS1 has "${CWD}" in the value, then ksh will
+ ;; display the current working directory but /bin/sh will display
+ ;; a dollar sign. The following command line sets $PS1 to a sane
+ ;; value, and works under Bourne-ish shells as well as csh-like
+ ;; shells. Daniel Pittman reports that the unusual positioning of
+ ;; the single quotes makes it work under `rc', too. We also unset
+ ;; the variable $ENV because that is read by some sh
+ ;; implementations (eg, bash when called as sh) on startup; this
+ ;; way, we avoid the startup file clobbering $PS1. $PROMP_COMMAND
+ ;; is another way to set the prompt in /bin/bash, it must be
+ ;; discarded as well.
(tramp-send-command
vec
(format
"exec env 'ENV=' 'PROMPT_COMMAND=' 'PS1=$ ' PS2='' PS3='' %s"
(tramp-get-method-parameter
(tramp-file-name-method vec) 'tramp-remote-sh))
- t))
+ t)
+
+ ;; Disable echo.
+ (tramp-message vec 5 "Setting up remote shell environment")
+ (tramp-send-command vec "stty -inlcr -echo kill '^U' erase '^H'" t)
+ ;; Check whether the echo has really been disabled. Some
+ ;; implementations, like busybox of embedded GNU/Linux, don't
+ ;; support disabling.
+ (tramp-send-command vec "echo foo" t)
+ (with-current-buffer (process-buffer proc)
+ (goto-char (point-min))
+ (when (looking-at "echo foo")
+ (tramp-set-connection-property proc "remote-echo" t)
+ (tramp-message vec 5 "Remote echo still on. Ok.")
+ ;; Make sure backspaces and their echo are enabled and no line
+ ;; width magic interferes with them.
+ (tramp-send-command vec "stty icanon erase ^H cols 32767" t))))
(tramp-message vec 5 "Setting shell prompt")
- ;; Douglas Gray Stephens <[email protected]> says that we must
- ;; use "\n" here, not tramp-rsh-end-of-line.
+ ;; We can set $PS1 to `tramp-end-of-output' only when the echo has
+ ;; been disabled. Otherwise, the echo of the command would be
+ ;; regarded as prompt already.
(tramp-send-command
vec
(format "PROMPT_COMMAND=''; PS1='%s%s%s'; PS2=''; PS3=''"
@@ -5651,27 +5669,6 @@ process to set up. VEC specifies the connection."
tramp-end-of-output
tramp-rsh-end-of-line)
t)
- ;; If the connection buffer is not empty, the remote shell is
- ;; echoing, and the prompt has been detected through the echoed
- ;; command. We must reread for the real prompt.
- (with-current-buffer (process-buffer proc)
- (when (> (point-max) (point-min)) (tramp-wait-for-output proc)))
-
- ;; Disable echo.
- (tramp-message vec 5 "Setting up remote shell environment")
- (tramp-send-command vec "stty -inlcr -echo kill '^U' erase '^H'" t)
- ;; Check whether the echo has really been disabled. Some
- ;; implementations, like busybox of embedded GNU/Linux, don't
- ;; support disabling.
- (tramp-send-command vec "echo foo" t)
- (with-current-buffer (process-buffer proc)
- (goto-char (point-min))
- (when (looking-at "echo foo")
- (tramp-set-connection-property vec "remote-echo" t)
- (tramp-message vec 5 "Remote echo still on. Ok.")
- ;; Make sure backspaces and their echo are enabled and no line
- ;; width magic interferes with them.
- (tramp-send-command vec "stty icanon erase ^H cols 32767" t)))
;; Try to set up the coding system correctly.
;; CCC this can't be the right way to do it. Hm.
@@ -6230,7 +6227,7 @@ is meant to be used from `tramp-maybe-open-connection' only. The
function waits for output unless NOOUTPUT is set."
(unless neveropen (tramp-maybe-open-connection vec))
(let ((p (tramp-get-connection-process vec)))
- (when (tramp-get-connection-property vec "remote-echo" nil)
+ (when (tramp-get-connection-property p "remote-echo" nil)
;; We mark the command string that it can be erased in the output buffer.
(tramp-set-connection-property p "check-remote-echo" t)
(setq command (format "%s%s%s" tramp-echo-mark command tramp-echo-mark)))