From: Sreekanta S. P. N. (Poornima)
<poo...@al...> - 2008-12-31 04:47:54
|
Hi, I am relatively new to Perl and Perl-expect. I am trying to debug an existing Perl code with expect usage in it. We are always the following error message “Error: could not connect pty as controlling terminal! “ I believe its due to expect not getting control of terminal, but otherwise the code runs ok. How do I suppress this message or avoid it altogether? Any help is very much appreciated. This is the code snippet:- if ($command eq "ssh") { foreach my $IP (@ipAdd) { print "executing Ssh on ip =$IP\n"; my $exp = new Expect; $exp->raw_pty(1); #should be before spawning to disable echoing $exp->manual_stty(1); #should be before spawning to disable echoing my $ret = $exp->spawn("ssh $IP -t vxShell"); -------→ is this the culprit ? my $err_ = $exp->exp_error(); if(!defined($ret)) { print "Send Spawn to $ip is failed\n"; push @junk_exps,$exp; next; } $exp->expect(65, [timeout => \&setTimeout], [qr/>:/ => \&doNothing], [eof => \&setEOF] ); if(&isErr()){ print "expecting prompt on spawn to $IP Failed\n"; push @junk_exps,$exp; next; } Now the code runs on solaris. The expect is supposed to spawn ssh on Vxworks system . Now the code runs fine but it always throws this message executing Ssh on ip = 1.2.3.4 Error: could not connect pty as controlling terminal! <<<< ------- Why is this coming ? expecting prompt on spawn to 1.2.3.4 Failed or alternaltively executing Ssh on ip = 1.2.3.4 Error: could not connect pty as controlling terminal! <<<←---------- why is this message coming expecting prompt on spawn to 1.2.3.4 success Thanks Poornima |