diff options
| author | Michael Albinus | 2023-12-24 11:35:16 +0100 |
|---|---|---|
| committer | Michael Albinus | 2023-12-24 11:35:16 +0100 |
| commit | 2a1a7a8524c0307c09c91e89816b2b2b8bfb85bc (patch) | |
| tree | de3fd18ecd16a32fe2d03965d056036d01e78dc1 | |
| parent | 9b8e0a54318fe909f321a9d437875c99f1bd4451 (diff) | |
| download | emacs-2a1a7a8524c0307c09c91e89816b2b2b8bfb85bc.tar.gz emacs-2a1a7a8524c0307c09c91e89816b2b2b8bfb85bc.zip | |
Make stty settings configurable in Tramp's make-process
* lisp/net/tramp-sh.el (tramp-pipe-stty-settings): New defcustom.
(tramp-sh-handle-make-process): Use it. (Bug#62093)
| -rw-r--r-- | lisp/net/tramp-sh.el | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 064045584ae..1777e2f1ed8 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -2877,7 +2877,16 @@ the result will be a local, non-Tramp, file name." | |||
| 2877 | (tramp-run-real-handler | 2877 | (tramp-run-real-handler |
| 2878 | #'expand-file-name (list localname)))))))))) | 2878 | #'expand-file-name (list localname)))))))))) |
| 2879 | 2879 | ||
| 2880 | ;;; Remote commands: | 2880 | ;;; Remote processes: |
| 2881 | |||
| 2882 | (defcustom tramp-pipe-stty-settings "-icanon min 1 time 0" | ||
| 2883 | "How to prevent blocking read in pipeline processes. | ||
| 2884 | This is used in `make-process' with `connection-type' `pipe'." | ||
| 2885 | :group 'tramp | ||
| 2886 | :version "29.3" | ||
| 2887 | :type '(choice (const :tag "Use size limit" "-icanon min 1 time 0") | ||
| 2888 | (const :tag "Use timeout" "-icanon min 0 time 1") | ||
| 2889 | string)) | ||
| 2881 | 2890 | ||
| 2882 | ;; We use BUFFER also as connection buffer during setup. Because of | 2891 | ;; We use BUFFER also as connection buffer during setup. Because of |
| 2883 | ;; this, its original contents must be saved, and restored once | 2892 | ;; this, its original contents must be saved, and restored once |
| @@ -3089,12 +3098,21 @@ implementation will be used." | |||
| 3089 | ;; otherwise strings larger than 4096 | 3098 | ;; otherwise strings larger than 4096 |
| 3090 | ;; bytes, sent by the process, could | 3099 | ;; bytes, sent by the process, could |
| 3091 | ;; block, see termios(3) and Bug#61341. | 3100 | ;; block, see termios(3) and Bug#61341. |
| 3101 | ;; In order to prevent blocking read | ||
| 3102 | ;; from pipe processes, "stty -icanon" | ||
| 3103 | ;; is used. By default, it expects at | ||
| 3104 | ;; least one character to read. When a | ||
| 3105 | ;; process does not read from stdin, | ||
| 3106 | ;; like magit, it should set a timeout | ||
| 3107 | ;; instead. See`tramp-pipe-stty-settings'. | ||
| 3108 | ;; (Bug#62093) | ||
| 3092 | ;; FIXME: Shall we rather use "stty raw"? | 3109 | ;; FIXME: Shall we rather use "stty raw"? |
| 3093 | (if (tramp-check-remote-uname v "Darwin") | 3110 | (tramp-send-command |
| 3094 | (tramp-send-command | 3111 | v (format |
| 3095 | v "stty -icanon min 1 time 0") | 3112 | "stty %s %s" |
| 3096 | (tramp-send-command | 3113 | (if (tramp-check-remote-uname v "Darwin") |
| 3097 | v "stty -icrnl -icanon min 1 time 0"))) | 3114 | "" "-icrnl") |
| 3115 | tramp-pipe-stty-settings))) | ||
| 3098 | ;; `tramp-maybe-open-connection' and | 3116 | ;; `tramp-maybe-open-connection' and |
| 3099 | ;; `tramp-send-command-and-read' could | 3117 | ;; `tramp-send-command-and-read' could |
| 3100 | ;; have trashed the connection buffer. | 3118 | ;; have trashed the connection buffer. |