IO.popen puts

  • Thread starter Rebhan, Gilbert
  • Start date
R

Rebhan, Gilbert

Hi,

i want to do a cvs login for a list of cvsrepositories
with IO.popen

the normal login via Windows shell looks like =3D

Y:\>cvs -d :pserver:username@cvshost:d:/cvsrepos/test login
Logging in to :pserver:username@cvshost:2401:d:/cvsrepos/test
CVS password: ********=20


i tried with =3D

cvsrepos=3D%w[test,test1,test2]
cvsrepos.each {|x|
IO.popen("#{CVSEXE} -d #{CVSROOT}/#{x} login", 'r+') do |pipe|
pipe << "password"
pipe.close_write
puts pipe.read
end
}

but the script hangs with the output
CVS password:

What went wrong ?


Regards, Gilbert
 
J

Jan Svitok

Hi,

i want to do a cvs login for a list of cvsrepositories
with IO.popen

the normal login via Windows shell looks like =

Y:\>cvs -d :pserver:username@cvshost:d:/cvsrepos/test login
Logging in to :pserver:username@cvshost:2401:d:/cvsrepos/test
CVS password: ********


i tried with =

cvsrepos=%w[test,test1,test2]
cvsrepos.each {|x|
IO.popen("#{CVSEXE} -d #{CVSROOT}/#{x} login", 'r+') do |pipe|
pipe << "password"
pipe.close_write
puts pipe.read
end
}

but the script hangs with the output
CVS password:

What went wrong ?

just a guess:
1. try adding newline
2. try redirecting stdin on the command line without ruby (maybe cvs
reads the keyboard directly)
 
R

Rebhan, Gilbert

=20
Hi,

-----Original Message-----
From: Jan Svitok [mailto:[email protected]]=20
Sent: Monday, March 05, 2007 12:48 PM
To: ruby-talk ML
Subject: Re: IO.popen puts

Hi,

i want to do a cvs login for a list of cvsrepositories
with IO.popen

the normal login via Windows shell looks like =3D

Y:\>cvs -d :pserver:username@cvshost:d:/cvsrepos/test login
Logging in to :pserver:username@cvshost:2401:d:/cvsrepos/test
CVS password: ********


i tried with =3D

cvsrepos=3D%w[test,test1,test2]
cvsrepos.each {|x|
IO.popen("#{CVSEXE} -d #{CVSROOT}/#{x} login", 'r+') do |pipe|
pipe << "password"
pipe.close_write
puts pipe.read
end
}

but the script hangs with the output
CVS password:

What went wrong ?

/*
just a guess:
1. try adding newline
2. try redirecting stdin on the command line without ruby (maybe cvs
reads the keyboard directly)
*/


Found a working solution that is much simpler =3D

cvsrepos=3D%w[...]
cvspass=3Dgets.chomp

cvsrepos.each {|x|
puts "Login CVS Repository >> #{x} ..."=20
IO.popen("#{CVSEXE} -d
:pserver:#{ENV["USERNAME"]}:#{cvspass}@cvshost:d:/cvsrepos/#{x} login")
}


the CVSROOT string takes a password too


Regards, Gilbert
 

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,780
Messages
2,569,608
Members
45,249
Latest member
KattieCort

Latest Threads

Top