From: Mopuri, S. <sha...@in...> - 2006-04-21 14:21:18
|
Hi, Sorry for skipping the details. What I am trying to say is, telnet is not spawned as I don't see it in the Task Manager Processes window. I don't get any errors but telnet is not invoked. I did try using Net::Telnet but did not make any difference. As for "\n", the shell does strip the whitespace.=20 Thanks for responding to my mail. Shailaja=20 -----Original Message----- From: Roland Giersig [mailto:RGi...@cp...]=20 Sent: Friday, April 21, 2006 1:38 AM To: Mopuri, Shailaja Cc: exp...@li... Subject: Re: [Expectperl-discuss] Telnet not working from Cygwin when using Expect/Perl Quoting "Mopuri, Shailaja" <sha...@in...>: > Hi, > I am trying to invoke telnet using Expect from Perl in Cygwin. The > same > code works in Linux systems which means there is something different > when invoked from Cygwin shell. Can anyone suggest any workarounds or > suggestions to fix this issue. What are the symptoms of the failure? Any error messages? "This does not work" is not an allowed problem-description for a technician... :-) Alternatively you could try to use Net::Telnet to connect and pass its filehandle to exp_init, so you would avoid the cygwin shell and ptys alltogether. > Below is the sample code that I am trying to get it work > > Thanks, > Shailaja > > #!/usr/bin/perl > > # use module > use XML::Simple; > use Expect; > > #Create the Expect handle > $Expect_Handle =3D3D new Expect; > $Cmds =3D3D "telnet atsism01 623"; > $Responses =3D3D "server:"; > $Result =3D3D $Expect_Handle->spawn($Cmds."\n"); Why the "\n"? This would make the last argument "623\n" (if the shell wouldn't strip whitespace). > # Clears the previous output accumulated incase of match failures > $Expect_Handle->clear_accum(); > $Pattern_ID =3D3D $Expect_Handle->expect($Timeout,'-re', $Responses); > #Capture the current prompt > $Current_Prompt =3D3D $Expect_Handle->match(); > #Capture the output > $ActualOutput =3D3D $Expect_Handle->before().$Current_Prompt; > =3D09 > -- RGi...@cp... |