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.)
···
–
-mark.
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
Mark Probert wrote:
···
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.)
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.
···
–
-mark.