PTY Multiple logins (readpartial blocks)

Hi everyone,

at the moment I’m working with ruby and pty to automate multiple logins
on some linux (RH7) servers. Certainly the logins stop between the 6th
and 10th login. Everytime I’m using readpartial or readline, the
loginprocess stops, like there is no data in the stdout. My ruby code is
similar to the one below:

15.times do |i|
puts “#{i + 1}. login:”
sleep 1
stdout, stdin, pid = PTY.spawn(“ssh -o NumberOfPasswordPrompts=1
[email protected]”)
sleep 1
puts stdout.readpartial(4096)
stdout.close
stdin.close
Process.kill(9, pid)
end

Could it be, that stdout has a limit of data storage or that i have to
invoke a command to flush stdout?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs