tags:

views:

154

answers:

1

Is it possible from within shoooes to spawn a separate thread which will read from a named pipe and then print whatever is written in that name pipe into a text box? Would anyone have an example of how to set that up?

+1  A: 

It's pretty easy to manipulate text across threads. Try this code, for example:

Shoes.app do
  @text = para 'Do you like ponies?'

  Thread.new do 
    sleep(4)
    @text.text += "  Of course I do!"
  end

  timer(2) {@text.text += "\nWhat a silly question."}
end

As to reading from a named pipe, they can be treated like any other file, with the caveat that they will block until the other side of the pipe is set up. So, either make them non-blocking or just set the other side up before you open the pipe.

Pesto