[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Feature request/wishlist: allowing external processes to accept input in
From: |
D Goel |
Subject: |
Feature request/wishlist: allowing external processes to accept input in script mode |
Date: |
Tue, 25 Oct 2005 19:16:46 -0400 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
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/
--
- Feature request/wishlist: allowing external processes to accept input in script mode,
D Goel <=