in reply to Testing terminal programs within emacs (or other IDEs)
tried this but wasn't sufficiently reliable, (but this couldhave been be caused by gnome-terminal weirdness)
The following hack works with xterm , put it at the very beginning of your program.
It restarts the program within a separate xterm-window but redirects STDERR to the parent process.
This allows running a terminal script from within emacs and should be easily adapted to other environments using l/unix.
All STDERR warnings show within emacs and are clickable to navigate to source file/line.
my $ptty=$ARGV[0]; if ($ENV{INSIDE_EMACS}) { my $tty=`tty`; delete $ENV{INSIDE_EMACS}; warn "restart in xterm $0 $tty\n"; my $x=`xterm -e '/usr/bin/perl $0 $tty'`; warn "xterm closed\n"; exit; } elsif ($ptty) { close STDERR; open STDERR,">",$ptty; local $\="\n"; warn "redirecting STDERR to $ptty\n"; $|=1; }
This approach can also be used by the perldebugger when debugging another Term::ReadLine application
When sufficiently tested this logic can be put into a separate module RunXTerm , no adjustments of editor needed.
I'm not overly familiar with tty and forking and open for cleaner suggestions. :)
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
|
---|