diff options
| author | Glenn Morris | 2008-11-30 01:28:01 +0000 |
|---|---|---|
| committer | Glenn Morris | 2008-11-30 01:28:01 +0000 |
| commit | 1e262c45664220c2cccf75d7b421edab11cab076 (patch) | |
| tree | 81c20bc9c292b7487623d0f3804d314a62a3e786 | |
| parent | 64ba814f12fea7884d6cc2c9e58f63b12b7d79f5 (diff) | |
| download | emacs-1e262c45664220c2cccf75d7b421edab11cab076.tar.gz emacs-1e262c45664220c2cccf75d7b421edab11cab076.zip | |
(eshell-needs-pipe): New variable.
(eshell-needs-pipe-p): New function.
(eshell-gather-process-output): Set process-connection-type according to
eshell-needs-pipe-p. (Bug#1388)
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/eshell/esh-proc.el | 32 |
2 files changed, 34 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2c6c789b67b..12e27d97c88 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2008-11-30 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * eshell/esh-proc.el (eshell-needs-pipe): New variable. | ||
| 4 | (eshell-needs-pipe-p): New function. | ||
| 5 | (eshell-gather-process-output): Set process-connection-type according to | ||
| 6 | eshell-needs-pipe-p. (Bug#1388) | ||
| 7 | |||
| 1 | 2008-11-30 Juanma Barranquero <lekktu@gmail.com> | 8 | 2008-11-30 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 9 | ||
| 3 | * calendar/diary-lib.el (diary-cyclic): Doc fix. | 10 | * calendar/diary-lib.el (diary-cyclic): Doc fix. |
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el index 25d9dd64663..20bc98c2ea7 100644 --- a/lisp/eshell/esh-proc.el +++ b/lisp/eshell/esh-proc.el | |||
| @@ -236,6 +236,26 @@ The prompt will be set to PROMPT." | |||
| 236 | "A marker that tracks the beginning of output of the last subprocess. | 236 | "A marker that tracks the beginning of output of the last subprocess. |
| 237 | Used only on systems which do not support async subprocesses.") | 237 | Used only on systems which do not support async subprocesses.") |
| 238 | 238 | ||
| 239 | (defvar eshell-needs-pipe '("bc") | ||
| 240 | "List of commands which need `process-connection-type' to be nil. | ||
| 241 | Currently only affects commands in pipelines, and not those at | ||
| 242 | the front. If an element contains a directory part it must match | ||
| 243 | the full name of a command, otherwise just the nondirectory part must match.") | ||
| 244 | |||
| 245 | (defun eshell-needs-pipe-p (command) | ||
| 246 | "Return non-nil if COMMAND needs `process-connection-type' to be nil. | ||
| 247 | See `eshell-needs-pipe'." | ||
| 248 | (and eshell-in-pipeline-p | ||
| 249 | (not (eq eshell-in-pipeline-p 'first)) | ||
| 250 | ;; FIXME should this return non-nil for anything that is | ||
| 251 | ;; neither 'first nor 'last? See bug#1388 discussion. | ||
| 252 | (catch 'found | ||
| 253 | (dolist (exe eshell-needs-pipe) | ||
| 254 | (if (string-equal exe (if (string-match "/" exe) | ||
| 255 | command | ||
| 256 | (file-name-nondirectory command))) | ||
| 257 | (throw 'found t)))))) | ||
| 258 | |||
| 239 | (defun eshell-gather-process-output (command args) | 259 | (defun eshell-gather-process-output (command args) |
| 240 | "Gather the output from COMMAND + ARGS." | 260 | "Gather the output from COMMAND + ARGS." |
| 241 | (unless (and (file-executable-p command) | 261 | (unless (and (file-executable-p command) |
| @@ -250,11 +270,13 @@ Used only on systems which do not support async subprocesses.") | |||
| 250 | (cond | 270 | (cond |
| 251 | ((fboundp 'start-process) | 271 | ((fboundp 'start-process) |
| 252 | (setq proc | 272 | (setq proc |
| 253 | (apply 'start-process | 273 | (let ((process-connection-type |
| 254 | (file-name-nondirectory command) nil | 274 | (unless (eshell-needs-pipe-p command) |
| 255 | ;; `start-process' can't deal with relative | 275 | process-connection-type))) |
| 256 | ;; filenames | 276 | (apply 'start-process |
| 257 | (append (list (expand-file-name command)) args))) | 277 | (file-name-nondirectory command) nil |
| 278 | ;; `start-process' can't deal with relative filenames. | ||
| 279 | (append (list (expand-file-name command)) args)))) | ||
| 258 | (eshell-record-process-object proc) | 280 | (eshell-record-process-object proc) |
| 259 | (set-process-buffer proc (current-buffer)) | 281 | (set-process-buffer proc (current-buffer)) |
| 260 | (if (eshell-interactive-output-p) | 282 | (if (eshell-interactive-output-p) |