Subject: Re: bug#1388: 23.0.60; Emacs shell problem with echo "1+1" | bc

From: Glenn Morris <[email-masked]>
Date: Sat, 22 Nov 2008 16:02:23 -0500

Stefan Monnier wrote:

> Yes, an appropriate binding of process-connection-type at the right
> place and the right time should do the trick.

Awesome, thanks. The following seems to work, though:

i) One needs to use either /bin/echo or set eshell-plain-echo-behavior
non-nil if `echo 1+1 | bc' is to work.

ii) I'm not sure whether the following is mistakenly changing the
behaviour of the first command in a pipeline. Can't think of a good
test for that...

*** esh-proc.el.~1.21.~	2008-05-20 16:28:53.000000000 -0700
--- esh-proc.el	2008-11-22 12:55:59.000000000 -0800
***************
*** 250,260 ****
      (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)))
        (eshell-record-process-object proc)
        (set-process-buffer proc (current-buffer))
        (if (eshell-interactive-output-p)
--- 250,263 ----
      (cond
       ((fboundp 'start-process)
        (setq proc
+ 	    ;; Bug#1388.  Some commands (eg bc) check isatty to decide
+ 	    ;; whether they are being called interactively.
+ 	    (let ((process-connection-type (unless eshell-in-pipeline-p
+ 					     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)