From: kazaam Date: 2007-11-18T16:45:00+09:00 Subject: Re: Executing another cmdl-app with ruby and typing in a password? --Signature=_Sun__18_Nov_2007_08_42_03_+0100_tco0Wn+dYlnUQJvE Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Thanks for pointing me in the right direction. I now wrote a little loop to= do this work: require 'pty' require 'expect' PTY.spawn("ruby test.rb") do |read_t,write_t,pid| write_t.sync =3D true read_t.expect(/^enter passphrase.*/) {write_t.print "123456"} end =20 But I have a problem. How to find out if the spawned process executed with = or without errors? I mean in this example "ruby test.rb". If I use system I= could do: puts "error" if not system("ruby test.rb") But PTY.spawn always just returns 'nil'. Is there any way I can check for c= orrect execution? --=20 kazaam --Signature=_Sun__18_Nov_2007_08_42_03_+0100_tco0Wn+dYlnUQJvE Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHP+zPhpGHCq8B1fYRAhrdAKDfAHatYuaVM92yfUR5zpDR9o8PEwCg8Ova S5vNkf4hUUGdYMMDie5AIY4= =yNzK -----END PGP SIGNATURE----- --Signature=_Sun__18_Nov_2007_08_42_03_+0100_tco0Wn+dYlnUQJvE--