Search code examples
multithreadingperlxterm

Threaded Perl with each thread in a new xterm


I'm creating a threaded program where not all threads are spawned at the beginning. Some have to wait for 1 or more threads to complete first. This would not be a problem, except I would like to keep the xterms open to read through the output. In some cases, piping to a file does not work as there is some fancy stuff going on with the terminal output where it overwrites itself.

I have been using my $xt_hold = "xterm -sl 5000 -geometry 350x50+0+100 -iconic -hold -e $cmd"; system($xt_hold); to create the xterm but this does not allow me to join the thread when it is finished. Is there another way I can keep the xterm open and know when/join the thread when it is finished?

If there is a better solution using GNU screen then I would probably be interested in that, but my primary choice would be xterm just because I am more familiar with it.


Solution

  • While trying to answer this, I realized something. The characters that were showing up in the text files were control characters for color and I guess there are also delete/backspace ones. These can only be interpreted by terminals, so I can just view the logfiles in the original terminal with less -r.