Re: GNU readline / tty related questions
- From: Barry Margolin <barmar@xxxxxxxxxxxx>
- Date: Fri, 25 May 2007 21:25:11 -0400
In article <1180103675.094305.230600@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
emiller_news@xxxxxxxxx wrote:
Hi,
I have to control a tool "A", that uses the GNU readline library for
it's command line, 'remotely' from another process "B". Currently I
send commands to and receive the output from the tool "A" via pipes.
The problem is that for example sending a <Tab> from "B" to "A"
doesn't start Tab-Completion and <Cursor-Up> doesn't read from the
history.
The readline library probably only processes control characters
specially when its input is a tty, not a pipe.
How can I have every key, that is typed in "B", sent to "A" so that it
is immediately interpreted as if it was typed in "A"s command line?
A problem that is probably related to this question is that, when
starting "A" via "execl(".../tool",...)" inside "B", the tool "A"
recognizes by calling isatty(), that it is not connected to a
terminal. Can I attach it to a tty before or after "execl()"? If not,
another option is to start "A" first on a terminal, if I can later
grab/send to that terminal from the control process "B" as mentioned
above.
Any clues how to do this?
Use a pseudo-tty (pty) rather than a pipe. You might want to make use
of Expect, a scripting language specifically designed for controlling
interactive programs.
--
Barry Margolin, barmar@xxxxxxxxxxxx
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
.
- Follow-Ups:
- Re: GNU readline / tty related questions
- From: emiller_news
- Re: GNU readline / tty related questions
- References:
- GNU readline / tty related questions
- From: emiller_news
- GNU readline / tty related questions
- Prev by Date: Re: How can a new process use a used port?
- Next by Date: Re: Best Programming language for Network programming (complex server application)
- Previous by thread: GNU readline / tty related questions
- Next by thread: Re: GNU readline / tty related questions
- Index(es):
Relevant Pages
|
|