Expect and Control characters!
- From: Sektor van Skijlen <ethouris@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 16 Apr 2005 20:37:34 +0000 (UTC)
Dnia Sat, 16 Apr 2005 03:44:32 GMT, Darren New skrobie:
> sigzero@xxxxxxxxx wrote:
> > I don't need to see anything just that the ^D exits the spawned
> > process.
> FWIW, ^D is not an "end of file" character like ^Z is on CP/M
> derivatives. ^D tells the terminal driver to send any buffered output to
> the program from the terminal driver. If there's no buffered output, it
> results in a 0-character read, which is interpreted as EOF. If you type
> ABC^D, the program will read three characters.
Good, but... I think the problem is different. Typing ^D in a shell when there
is no character in buffer (typed but not "Entered") means "EOF". So, what does
^D mean in the same situation in Expect script (the script has sent some
command, sent \r, and "expected" all characters from the terminal)? Should the
terminal react differently? AFAIR, the terminal does not see the difference
between being manager by a human or by an expect script, so?
Maybe this is a problem with control characters? I have similar problem in my
expect script. This script connects remotely to a console-based application
(something with readline-like interface), then sends some commands and expects
some results. Sometimes, however, the result can come back in a very long
time. I have to predict some timeout. When the command looks timed out, I want
to stop the operation and repeat it. Normally, when I'm connecting manually,
using telnet, I have to type ^C (admittedly, the expect script also uses the
telnet application rather than TCP-socket connection). So, when there comes
the moment, when I have to break the command (to regain the CLI), I do:
exp_send "^C"
(I used ^ and C here, but in the script I used in vim the ^V^C combination).
In effect, the script sent some unrecognizable string of four (maybe four)
characters. Of course, nothing happened except that the command written next
was prepended by this string and so unrecognized.
I tried also to use "binary format" - maybe my control character was somehow
translated or something; indeed Tcl uses Unicode. But the string produced via
"binary format" did not do anything (I didn't observe any character written to
the application's console, nor any signal that the ^C character has been
received).
Is there some special method to send control characters in Expect?
--
// _ ___ Michal "Sektor" Malecki <sektor(whirl)kis.p.lodz.pl>
\\ L_ |/ `| /^\ ,() <ethourhs(O)wp.pl>
// \_ |\ \/ \_/ /\ C++ bez cholesterolu: http://www.intercon.pl/~sektor/cbx
"Java does not have pointers!"
.
- Follow-Ups:
- Re: Expect and Control characters!
- From: Cameron Laird
- Re: Expect and Control characters!
- References:
- Expect and SU
- From: sigzero
- Re: Expect and SU
- From: Darren New
- Expect and SU
- Prev by Date: Re: Tile treeview CPU-usage
- Next by Date: Re: tcl 8.5 & Slackware
- Previous by thread: Re: Expect and SU
- Next by thread: Re: Expect and Control characters!
- Index(es):
Relevant Pages
|