summaryrefslogtreecommitdiff
path: root/lib/Term
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-03-25 20:37:43 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-03-25 20:37:43 +0000
commit4c3ccbe1ab62eea08559462633253b2fb98ab98a (patch)
tree76042189356cddd91834b77a02b4fd15c483717c /lib/Term
parenta019d6327ffe386ac9eafb3115b5da790de7c766 (diff)
downloadperl-4c3ccbe1ab62eea08559462633253b2fb98ab98a.tar.gz
A workaround for using Term::ReadLine in emacs minibuffer
from Wybo Dekker <wybo@servalys.nl> and Johan Vromans; additional tweaks from Ilya Zakharevich. p4raw-id: //depot/perl@9344
Diffstat (limited to 'lib/Term')
-rw-r--r--lib/Term/ReadLine.pm18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/Term/ReadLine.pm b/lib/Term/ReadLine.pm
index 491ce79cbe..5a8c251619 100644
--- a/lib/Term/ReadLine.pm
+++ b/lib/Term/ReadLine.pm
@@ -157,6 +157,22 @@ empty, the best available package is loaded.
(Note that processing of C<PERL_RL> for ornaments is in the discretion of the
particular used C<Term::ReadLine::*> package).
+=head1 CAVEATS
+
+It seems that using Term::ReadLine from Emacs minibuffer doesn't work
+quite right and one will get an error message like
+
+ Cannot open /dev/tty for read at ...
+
+One possible workaround for this is to explicitly open /dev/tty like this
+
+ open (FH, "/dev/tty" )
+ or eval 'sub Term::ReadLine::findConsole { ("&STDIN", "&STDERR") }';
+ die $@ if $@;
+ close (FH);
+
+or you can try using the 4-argument form of Term::ReadLine->new().
+
=cut
use strict;
@@ -225,7 +241,7 @@ sub new {
#local (*FIN, *FOUT);
my ($FIN, $FOUT, $ret);
if (@_==2) {
- my($console, $consoleOUT) = findConsole;
+ my($console, $consoleOUT) = $_[0]->findConsole;
open(FIN, "<$console");
open(FOUT,">$consoleOUT");