Periodic retrieval fo stdout

Hi,
I am using Open3.popen to run a make command which takes 5-10 mins to
complete. I have put the popen command in a Thread.new {}. However, it
is
still getting blocked (I have a UI written in FXRuby).

  1. I want to retrieve the stdout periodically (to show in a status box)
  2. or at the very least, I want the ruby thread to continue (it is
    getting
    blocked) with the UI tasks. Is the thread getting blocked due to a
    system
    call??

Thanks in advance,
Ajith

On Fri, 30 Jun 2006, Max wrote:

Thanks in advance,
Ajith

are you on windows? if so you’ll have a hard time making this work. if
not
you might want to try my session lib, it wraps open3 in a way that makes
what
you are wanting to do quite simple. for example you might do something
like

sh = Session.new

command = ‘program’

status_box = widget.status_box

Thread.new{
exitstatus =
sh.execute(command) do |stdout, stderr|
if stdout
status_box.update_stdout stdout
end
if stderr
status_box.update_stderr stderr
end
end
}

and this should not block your ui, in fact that’s what session was
designed
for.

regards.

-a

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