CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
Automating Password entry(involving git)

 



ssandela
New User

Jul 29, 2010, 10:17 PM

Post #1 of 1 (1650 views)
Automating Password entry(involving git) Can't Post

Hi,

I am trying to use expect to automate the password entry process with git pull. I am able to understand and use expect.pm and verified it on "ssh -l server" command, but when i replace the command with "git pull" the script doesnt work. Following is the script am using and the error i get.

CODE:

use Expect;
use strict;

my $exp = Expect->new();
$exp->debug(3);
$exp->exp_internal(1);
$exp->spawn("git pull");

if($exp->expect(1, '-re', '.*?password.*'))
{
$exp->send("!w^\$e*\r");
$exp->send("ls -al > /tmp/ls.txt\r");
}
else
{
warn("inside else\n");
}
$exp->soft_close();

Error:
After spawning the command, the control always enters in to else part. I tried with different regular expression patterns but it never works.. I have even tried with regular expression of ".*+.*", in this case the if part got executed but the "send" is not able to do its job.

Can somebody please help me
1)Understand why is the problem with git.
2)any other way of automating the password entry in perl using any other mechanis.

Thanks in anticipation.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives