From: Michael Albinus Date: Sun, 28 Jan 2024 09:31:45 +0000 (+0100) Subject: Handle wrong login program in Tramp X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d8a1e0dfa7ae45caa62dd5b98dfe431ef3ca4700;p=emacs.git Handle wrong login program in Tramp * lisp/net/tramp-sh.el (tramp-maybe-open-connection): Exit remote shell when login fails. (cherry picked from commit e11c9f9c6e843779c4b69097490dd78de522a79d) --- diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 84912bdfe6a..526cc6e3fd2 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -5342,13 +5342,28 @@ connection if a previous connection has died for some reason." :method l-method :user l-user :domain l-domain :host l-host :port l-port))) - ;; Set session timeout. - (when (tramp-get-method-parameter - hop 'tramp-session-timeout) - (tramp-set-connection-property - p "session-timeout" - (tramp-get-method-parameter - hop 'tramp-session-timeout))) + ;; Replace `login-args' place holders. + (setq + command + (mapconcat + #'identity + (append + ;; We do not want to see the trailing local + ;; prompt in `start-file-process'. + (unless r-shell '("exec")) + `(,command) + ;; Add arguments for asynchronous processes. + (when process-name async-args) + (tramp-expand-args + hop 'tramp-login-args + ?h (or l-host "") ?u (or l-user "") ?p (or l-port "") + ?c (format-spec options (format-spec-make ?t tmpfile)) + ?n (concat + "2>" (tramp-get-remote-null-device previous-hop)) + ?l (concat remote-shell " " extra-args " -i")) + ;; A restricted shell does not allow "exec". + (when r-shell '("&&" "exit")) '("||" "exit")) + " ")) ;; Replace `login-args' place holders. (setq