# Periodic retrieval fo stdout

**URL:** <https://www.ruby-forum.com/t/periodic-retrieval-fo-stdout/96617>\
**Category:** Ruby\
**Created:** [June 30, 2006, 9:06am UTC](https://www.ruby-forum.com/t/periodic-retrieval-fo-stdout/96617 "2006-06-30T09:06:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![max](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e5b9ba/32.png) [@max](https://www.ruby-forum.com/u/max)\
**Post date:** [June 30, 2006, 9:06am UTC](https://www.ruby-forum.com/t/periodic-retrieval-fo-stdout/96617/1 "2006-06-30T09:06:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![max](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e5b9ba/32.png) [@max](https://www.ruby-forum.com/u/max)\
**Post date:** [June 30, 2006, 3:15pm UTC](https://www.ruby-forum.com/t/periodic-retrieval-fo-stdout/96617/2 "2006-06-30T15:15:22Z")

</div>

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
