Forum: Ruby Shell login with IO.popen?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
M.W. M. (Guest)
on 2007-06-19 22:46
(Received via mailing list)
Been messing around with IO and shell/system commands. I can't seem to
figure out why the first example works, and the second one doesn't.
Would someone be so kind and explain why this happens?

su = IO.popen("su - #{USERNAME}", 'w+')
su.puts PASSWORD
su.puts 'pwd'
puts su.readlines

login = IO.popen("login", 'w+')
login.puts USERNAME
login.puts PASSWORD
login.puts 'pwd'
puts login.readlines

For the second one, I keep getting Invalid Login. Like it's not really
getting what I'm putting in to STDIN?

Thanks for helping out!
This topic is locked and can not be replied to.