aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/net
diff options
context:
space:
mode:
authorMichael Albinus2013-12-06 16:34:06 +0100
committerMichael Albinus2013-12-06 16:34:06 +0100
commit4803595dfd00ce07cd09913ee3c5d40a023f3a08 (patch)
tree5206084ae7db0df727e0f376536393d287899cc1 /lisp/net
parenta59d76e05f20a25ecec8fc83834ba03c343ae4a2 (diff)
downloademacs-4803595dfd00ce07cd09913ee3c5d40a023f3a08.tar.gz
emacs-4803595dfd00ce07cd09913ee3c5d40a023f3a08.zip
Bug#16045
* progmodes/compile.el (compilation-start): * progmodes/grep.el (rgrep): Revert change of 2012-12-20T11:15:38Z!michael.albinus@gmx.de. * net/tramp-sh.el (tramp-sh-handle-start-file-process): Handle long command lines, lasting from "sh -c ...". (Bug#16045)
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/tramp-sh.el61
1 files changed, 40 insertions, 21 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 6beece526ff..314c1a6f8e7 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2686,27 +2686,46 @@ the result will be a local, non-Tramp, filename."
2686(defun tramp-sh-handle-start-file-process (name buffer program &rest args) 2686(defun tramp-sh-handle-start-file-process (name buffer program &rest args)
2687 "Like `start-file-process' for Tramp files." 2687 "Like `start-file-process' for Tramp files."
2688 (with-parsed-tramp-file-name default-directory nil 2688 (with-parsed-tramp-file-name default-directory nil
2689 ;; When PROGRAM is nil, we just provide a tty. 2689 (let* (;; When PROGRAM matches "*sh", and the first arg is "-c",
2690 (let ((command 2690 ;; it might be that the arguments exceed the command line
2691 (when (stringp program) 2691 ;; length. Therefore, we modify the command.
2692 (format "cd %s; exec env PS1=%s %s" 2692 (heredoc (and (stringp program)
2693 (tramp-shell-quote-argument localname) 2693 (string-match "sh$" program)
2694 ;; Use a human-friendly prompt, for example for `shell'. 2694 (string-equal "-c" (car args))
2695 (tramp-shell-quote-argument 2695 (= (length args) 2)))
2696 (format "%s %s" 2696 ;; When PROGRAM is nil, we just provide a tty.
2697 (file-remote-p default-directory) 2697 (args (if (not heredoc) args
2698 tramp-initial-end-of-output)) 2698 (let ((i 250))
2699 (mapconcat 'tramp-shell-quote-argument 2699 (while (and (< i (length (cadr args)))
2700 (cons program args) " ")))) 2700 (string-match " " (cadr args) i))
2701 (tramp-process-connection-type 2701 (setcdr
2702 (or (null program) tramp-process-connection-type)) 2702 args
2703 (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) 2703 (list (replace-match " \\\\\n" nil nil (cadr args))))
2704 (name1 name) 2704 (setq i (+ i 250))))
2705 (i 0) 2705 (cdr args)))
2706 ;; We do not want to raise an error when 2706 (command
2707 ;; `start-file-process' has been started several time in 2707 (when (stringp program)
2708 ;; `eshell' and friends. 2708 (format "cd %s; exec %s env PS1=%s %s"
2709 (tramp-current-connection nil)) 2709 (tramp-shell-quote-argument localname)
2710 (if heredoc "<<EOF" "")
2711 ;; Use a human-friendly prompt, for example for `shell'.
2712 (tramp-shell-quote-argument
2713 (format "%s %s"
2714 (file-remote-p default-directory)
2715 tramp-initial-end-of-output))
2716 (if heredoc
2717 (format "%s\n%s\nEOF" program (car args))
2718 (mapconcat 'tramp-shell-quote-argument
2719 (cons program args) " ")))))
2720 (tramp-process-connection-type
2721 (or (null program) tramp-process-connection-type))
2722 (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
2723 (name1 name)
2724 (i 0)
2725 ;; We do not want to raise an error when
2726 ;; `start-file-process' has been started several time in
2727 ;; `eshell' and friends.
2728 (tramp-current-connection nil))
2710 2729
2711 (unless buffer 2730 (unless buffer
2712 ;; BUFFER can be nil. We use a temporary buffer. 2731 ;; BUFFER can be nil. We use a temporary buffer.