From: Matthew Williams Date: 2006-11-17T04:55:27+09:00 Subject: Re: testing whether a process has completed.. > Is what you want possible in another language? It might help > clarify what you need... I'm not sure, have never had to do this before >> - I am running a Ruby program from my Rails application using: >> >> > thread = Thread.new do >> > IO.popen("ruby my_program.rb", "r+") do |pipe| >> > while !pipe.eof >> > NOW - I NEED TO KNOW HOW TO CHECK IF THE RUBY PROGRAM IS WAITING FOR INPUT >> >> ..i can read from it by reading and then checking if this returns 'nil'; > > You mean this thread reading from pipe? Having two programs here > confuses the issue somewhat. yes - Thread created in Rails app is running external Roby program - and needs to display output and know when its waiting for input > > If it > is running as a separate process, I don't see how you could interrogate > it from this process. It would have to prompt you for input, use > some other channel (sockets?) to tell you, etc. > Because you have done "ruby my_program.rb", that's in a shell running > another copy of ruby. You can't really get at the internals even from > the shell. Even Expect scripts rely on prompting. So your saying that, when running a program from the command prompt, it isn't possible to find out if the program is waiting for input from the user or is just executing part of the program? So how would you advise i go about trying to determine whether or not the program is waiting for input? Should i wait for a certain time and then try and write to the program? -- Posted via http://www.ruby-forum.com/.