> Term::ReadLine allows defining explicit IN and OUT handles which may be redirected to a separate xterm window?

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.

disclaimer
It's a proof of concept hack!!!

I'm not overly familiar with tty and forking and open for cleaner suggestions. :)

Cheers Rolf

(addicted to the Perl Programming Language and ☆☆☆☆ :)


In reply to Re: Testing terminal programs within emacs (SOLVED) by LanX
in thread Testing terminal programs within emacs (or other IDEs) by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.