[comp.emacs] question/buggestion about gnuemacs' call-process<f>

mayer@hplabsz.HPL.HP.COM (Niels Mayer) (08/21/87)

As far as I can tell, the function call-process will not return the exit
status of the program that it runs. (both version 18.44 and 18.47)

For example:

1-elisp)
   (call-process "grep" nil (get-buffer-create "out") t "hplnpm" "/etc/wank")
   --> nil
   (progn  (set-buffer "out") (buffer-string))
   --> "grep: can't open /etc/wank"

1-csh)
   hplnpm[3] ~> grep hplnpm /etc/wank &
   --> [1] 410
   --> grep: can't open /etc/wank
   --> [1]   Exit 2               grep hplnpm /etc/wank

2-elisp)
   (call-process "grep" nil (get-buffer-create "out") t "hplnpm" "/etc/hosts")
   --> nil
   (progn  (set-buffer "out") (buffer-string))
   --> "666.666.666.666    hplnpm  beelzebub                # DCC  HP-UX Bobcat-20"

2-csh)
   hplnpm[4] ~> grep hplnpm /etc/hosts &
   --> [1] 412
   --> 666.666.666.666    hplnpm  beelzebub                # DCC  HP-UX Bobcat-20
   --> [1]   Done                 grep hplnpm /etc/hosts

3-elisp)
   (call-process "grep" nil (get-buffer-create "out") t "wank" "/etc/hosts")
   --> nil
   (progn  (set-buffer "out") (buffer-string))
   --> ""

3-csh)
   hplnpm[5] ~> grep wank /etc/hosts &
   --> [2] 413
   --> [2]   Exit 1               grep wank /etc/hosts


Obviously, it would lead to far less kludgy emacs-lisp programs if
call-process returned the exit status of the program that it runs, since many
unix programs return useful information in the exit status. It leads to
total grodyness if one has to figure out what went wrong with the program
from the program's stdout.

Does anybody have a modified call-process that can do this? If not, could
the gnuemacs developers take this as an enhancement request? I'd be willing
to do it myself, given appropriate hints from any willing gnuru or gnu
bhagwan.

-------------------------------------------------------------------------------
	    Niels Mayer -- hplabs!mayer -- mayer@hplabs.hp.com
		       Hewlett-Packard Laboratories
			      Palo Alto, CA.
				   *

mayer@hplabsz.HPL.HP.COM (Niels Mayer) (08/23/87)

Forget about that last question. I figured out how to get the equivalent of
having call-process return exit status by starting the process with
start-process and using a process-sentinel to tell me the exit status when the
process finishes. In addition, the process now runs as if it were in the
background, which is even better since gnuemacs doesn't freeze while the
process is running.

Many thanks to Dale Worley for his response to Ashwin Ram's query about
processes... his pointer to set-process-sentinel is exactly the hint I
needed.

-- Niels.