Hi all,

I've been experimenting with connecting IO::Pty to a TextCtrl, and it 
has become immediately obvious (to me) that this will need a fancier 
TextCtrl and some key-specific handling.

  http://scratchcomputing.com/svn/Wx-Perl-Pty/trunk

I still need to setup the callback API and get this + the 
Wx::Perl::IO::Select on CPAN (it is also in my svn as of last night.)

But, this should take care of the blocking IO problems on subprocesses 
that don't explicitly unbuffer their output.

Note that anything on a pipe is block buffered by default, so the first 
command here won't show any output until it exits despite the fact that 
a newline was printed.  With a pty, the child process is line buffered 
(as you see in the 3rd command.)

  1.# perl -e 'print "foo\n"; sleep 1' | cat
  2.# perl -e '$|=1; print "foo\n"; sleep 1' | cat
  3.# perl -e 'print "foo\n"; sleep 1'
  4.# perl -e '$|=1; print "foo"; sleep 1'
  5.# perl -e 'print "foo"; sleep 1'

This provides generic "run this program and display the output in a 
TextCtrl" shell embedded in your Wx apps.

I would like to hear from our numerous wxPerl IDE developers about what 
you want the API to do.

What it doesn't do is interpret and display any ANSI color output (i.e. 
`ls --color=auto`.)  Anyone want to take a swing at handling the 
colorful bits?

If you're interested, please checkout the svn trees and try 
examples/bash.pl.

Thanks,
Eric
-- 
"Time flies like an arrow, but fruit flies like a banana."
--Groucho Marx
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------

Reply via email to