diff options
author | Glenn Morris <rgm@gnu.org> | 2008-11-30 01:28:01 +0000 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2008-11-30 01:28:01 +0000 |
commit | 1e262c45664220c2cccf75d7b421edab11cab076 (patch) | |
tree | 81c20bc9c292b7487623d0f3804d314a62a3e786 /lisp/eshell | |
parent | 64ba814f12fea7884d6cc2c9e58f63b12b7d79f5 (diff) | |
download | emacs-1e262c45664220c2cccf75d7b421edab11cab076.tar.gz |
(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)
Diffstat (limited to 'lisp/eshell')
-rw-r--r-- | lisp/eshell/esh-proc.el | 32 |
1 files changed, 27 insertions, 5 deletions
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." "A marker that tracks the beginning of output of the last subprocess. Used only on systems which do not support async subprocesses.") +(defvar eshell-needs-pipe '("bc") + "List of commands which need `process-connection-type' to be nil. +Currently only affects commands in pipelines, and not those at +the front. If an element contains a directory part it must match +the full name of a command, otherwise just the nondirectory part must match.") + +(defun eshell-needs-pipe-p (command) + "Return non-nil if COMMAND needs `process-connection-type' to be nil. +See `eshell-needs-pipe'." + (and eshell-in-pipeline-p + (not (eq eshell-in-pipeline-p 'first)) + ;; FIXME should this return non-nil for anything that is + ;; neither 'first nor 'last? See bug#1388 discussion. + (catch 'found + (dolist (exe eshell-needs-pipe) + (if (string-equal exe (if (string-match "/" exe) + command + (file-name-nondirectory command))) + (throw 'found t)))))) + (defun eshell-gather-process-output (command args) "Gather the output from COMMAND + ARGS." (unless (and (file-executable-p command) @@ -250,11 +270,13 @@ Used only on systems which do not support async subprocesses.") (cond ((fboundp 'start-process) (setq proc - (apply 'start-process - (file-name-nondirectory command) nil - ;; `start-process' can't deal with relative - ;; filenames - (append (list (expand-file-name command)) args))) + (let ((process-connection-type + (unless (eshell-needs-pipe-p command) + process-connection-type))) + (apply 'start-process + (file-name-nondirectory command) nil + ;; `start-process' can't deal with relative filenames. + (append (list (expand-file-name command)) args)))) (eshell-record-process-object proc) (set-process-buffer proc (current-buffer)) (if (eshell-interactive-output-p) |