net/telnet problem

M

Mark Probert

Hi.

I am not sure how to handle this telnet problem. Any ideas appreciated.

I am running a telnet command that has a pager enabled (there is no way
not to have the pager enabled). The output is something like:

Tue 09-Sep-2003 16:56:01 blah blah
Tue 09-Sep-2003 16:56:02 foo bar
--More--('q' to end display)

Except that the '--More-- etc' part is -not- part of the output stream.

So, I try and get around it by setting a specific timeout and catching
the exception. Except I seem not to be able to get the data.

begin
str = @conn.waitfor('Match' => /\#/,
'Timeout' => 15)
puts str
rescue TimeoutError => e
puts str
puts "attempting to terminate!!!!"
@conn.write("q\n")
@conn.waitfor(/\#/) { |str| puts str }
end

(A bit hacked from the real code, however the idea is there.)
 
B

Bermejo, Rodrigo

assuming you are on *ix.

Have you tried changing your PAGER settings ?
export PAGER=cat

or you can create a suicidal shell script which invokes the application

@conn.cmd("sh sucidal_script.sh")

-rbermejo
 
M

Mark Probert

Hi, Rodrigo.
assuming you are on *ix.

Alas, this not the case ...

Taking the 'catch the timeout' seems to be working ok, so I'll go with that
until something better spring to mind.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top