diff options
| author | Eli Zaretskii | 2022-10-15 13:59:49 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2022-10-15 13:59:49 +0300 |
| commit | 63d084d4e435ae80e41ed19cfc48658819f84477 (patch) | |
| tree | dc65f8218b0bad987f4b1e6c2efbce7dfe2d9a0c | |
| parent | 1ebabaf9ff1d7d3365d92ed2ac38c8cec9e9aa68 (diff) | |
| download | emacs-63d084d4e435ae80e41ed19cfc48658819f84477.tar.gz emacs-63d084d4e435ae80e41ed19cfc48658819f84477.zip | |
Fix encoding and decoding of process I/O in Eshell on Windows
* lisp/eshell/esh-proc.el (eshell-gather-process-output): Set up
encoding and decoding of text to/from the subprocess for
MS-Windows. (Bug#58281)
| -rw-r--r-- | lisp/eshell/esh-proc.el | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el index 7e005a0fc1c..bb928fc5fb0 100644 --- a/lisp/eshell/esh-proc.el +++ b/lisp/eshell/esh-proc.el | |||
| @@ -277,7 +277,23 @@ Used only on systems which do not support async subprocesses.") | |||
| 277 | eshell-delete-exited-processes | 277 | eshell-delete-exited-processes |
| 278 | delete-exited-processes)) | 278 | delete-exited-processes)) |
| 279 | (process-environment (eshell-environment-variables)) | 279 | (process-environment (eshell-environment-variables)) |
| 280 | (coding-system-for-read coding-system-for-read) | ||
| 281 | (coding-system-for-write coding-system-for-write) | ||
| 280 | proc stderr-proc decoding encoding changed) | 282 | proc stderr-proc decoding encoding changed) |
| 283 | ;; MS-Windows needs special setting of encoding/decoding, because | ||
| 284 | ;; (a) non-ASCII text in command-line arguments needs to be | ||
| 285 | ;; encoded in the system's codepage; and (b) because many Windows | ||
| 286 | ;; programs will always interpret any non-ASCII input as encoded | ||
| 287 | ;; in the system codepage. | ||
| 288 | (when (eq system-type 'windows-nt) | ||
| 289 | (or coding-system-for-read ; Honor manual decoding settings | ||
| 290 | (setq coding-system-for-read | ||
| 291 | (coding-system-change-eol-conversion locale-coding-system | ||
| 292 | 'dos))) | ||
| 293 | (or coding-system-for-write ; Honor manual encoding settings | ||
| 294 | (setq coding-system-for-write | ||
| 295 | (coding-system-change-eol-conversion locale-coding-system | ||
| 296 | 'unix)))) | ||
| 281 | (cond | 297 | (cond |
| 282 | ((fboundp 'make-process) | 298 | ((fboundp 'make-process) |
| 283 | (unless (equal (car (aref eshell-current-handles eshell-output-handle)) | 299 | (unless (equal (car (aref eshell-current-handles eshell-output-handle)) |
| @@ -325,7 +341,7 @@ Used only on systems which do not support async subprocesses.") | |||
| 325 | (setq decoding (coding-system-change-eol-conversion decoding 'dos) | 341 | (setq decoding (coding-system-change-eol-conversion decoding 'dos) |
| 326 | changed t)) | 342 | changed t)) |
| 327 | ;; Even if `make-process' left the coding system for encoding | 343 | ;; Even if `make-process' left the coding system for encoding |
| 328 | ;; data sent from the process undecided, we had better use the | 344 | ;; data sent to the process undecided, we had better use the |
| 329 | ;; same one as what we use for decoding. But, we should | 345 | ;; same one as what we use for decoding. But, we should |
| 330 | ;; suppress EOL conversion. | 346 | ;; suppress EOL conversion. |
| 331 | (if (and decoding (not encoding)) | 347 | (if (and decoding (not encoding)) |