From: Brian Candler Date: 2010-06-16T17:18:20+09:00 Subject: Re: Simulating keystrokes for automated user input Ryan Mohr wrote: > The solution needs to generate a keystroke programmatically such that > the console has no idea whether it was physically typed by the user or > not. > > Tried writing to a modified stdin, directly editing /dev/tty, redirected > echos... no luck yet. > > Any ideas? Spawn a pty. There's pty.so in the standard library, which is a C extension and unfortunately not well documented, but google for "PTY.spawn" to find some examples, e.g. http://www.ruby-forum.com/topic/133560 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/pty/expect_sample.rb?view=markup -- Posted via http://www.ruby-forum.com/.