all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Feature request/wishlist: allowing external processes to accept input in script mode
@ 2005-10-25 23:16 D Goel
  2005-10-25 23:52 ` Andreas Schwab
  2005-10-27  1:29 ` Richard M. Stallman
  0 siblings, 2 replies; 5+ messages in thread
From: D Goel @ 2005-10-25 23:16 UTC (permalink / raw)




Emacs now has a --script option, which allows one to use emacs for all
scripting purposes.

Emacs scripts can call other processes, and those other processes can
call emacs scripts in turn, and so on, just as if the emacs script was
any other bash script.  

... except:

It seems, however, that if one of those external processes requires a
user input, then emacs exits with an error, as seen in the example
below.  Indeed, `call-process' does not seem to allow infile to be
stdin. (Or, did I screw up?)

Can the infile non allow a stdin option when emacs is invoked via a
emacs --script?

---
Example:

Save this as an executable y-or-n-p-my in ~/bin/
----
#!/bin/bash
echo -n "$@" '[y/n] '
read ans

case "$ans" in
    y*|Y*)
	exit 0
	;;
    *)
	exit 1
	;;
esac
----

Now we call the above bash script from an emacs script, in various
ways:

----
#!/usr/local/bin/emacscvs --script


(setq a (call-process "y-or-n-p-my" nil t  t "Question"))
(message "PR1: %S" a)

(with-temp-buffer "*tmp*" 
		  (message "%S" (buffer-string)))




(setq a (call-process-shell-command "y-or-n-p-my Question" nil t  t
"ans"))

(message "PR2: %S" a)
(with-temp-buffer "*tmp*" 
		  (message "%S" (buffer-string)))



(setq a (shell-command-to-string "y-or-n-p-my Question"))


(message "SHELL COMMAND: %S" a)
----

In each case, it all goes fine right until the external process waits
for user input.

Am I missing the right way to call an external process from an emacs
script?   


Sincerely,

DG                                 http://gnufans.net/
--

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-10-27  1:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-25 23:16 Feature request/wishlist: allowing external processes to accept input in script mode D Goel
2005-10-25 23:52 ` Andreas Schwab
2005-10-26 14:57   ` D Goel
2005-10-26 15:54     ` Kevin Rodgers
2005-10-27  1:29 ` Richard M. Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.