summaryrefslogtreecommitdiff
path: root/lib/Term
diff options
context:
space:
mode:
authorMartti Rahkila <martti.rahkila@hut.fi>2003-01-18 02:25:39 +0200
committerJarkko Hietaniemi <jhi@iki.fi>2003-01-22 12:43:31 +0000
commite05a8f29fa78aef20a9869bf742d9b3217cda019 (patch)
treececad11f29dbc1858eb37aad895bc9ade45f905f /lib/Term
parent906ed6d684efe07b1689c9b36fd4e093243a24dc (diff)
downloadperl-e05a8f29fa78aef20a9869bf742d9b3217cda019.tar.gz
Term::Complete problem + fix (Was: Re: muttprofile + perl 5.8)
Message-ID: <20030118002539.A30585@wurlitzer.hut.fi> (chose the 'even safer' version) p4raw-id: //depot/perl@18553
Diffstat (limited to 'lib/Term')
-rw-r--r--lib/Term/Complete.pm21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/Term/Complete.pm b/lib/Term/Complete.pm
index 4ae454144f..c74907bb59 100644
--- a/lib/Term/Complete.pm
+++ b/lib/Term/Complete.pm
@@ -5,7 +5,7 @@ require Exporter;
use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw(Complete);
-our $VERSION = '1.4';
+our $VERSION = '1.401';
# @(#)complete.pl,v1.2 (me@anywhere.EBay.Sun.COM) 09/23/91
@@ -66,7 +66,7 @@ Wayne Thompson
=cut
-our($complete, $kill, $erase1, $erase2, $tty_raw_noecho, $tty_restore, $stty);
+our($complete, $kill, $erase1, $erase2, $tty_raw_noecho, $tty_restore, $stty, $tty_safe_restore);
our($tty_saved_state) = '';
CONFIG: {
$complete = "\004";
@@ -77,6 +77,7 @@ CONFIG: {
if (-x $s) {
$tty_raw_noecho = "$s raw -echo";
$tty_restore = "$s -raw echo";
+ $tty_safe_restore = $tty_restore;
$stty = $s;
last;
}
@@ -106,8 +107,8 @@ sub Complete {
$tty_saved_state = undef;
}
else {
- chomp $tty_saved_state;
- $tty_restore = qq($stty "$tty_saved_state");
+ $tty_saved_state =~ s/\s+$//g;
+ $tty_restore = qq($stty "$tty_saved_state" 2>/dev/null);
}
}
system $tty_raw_noecho if defined $tty_raw_noecho;
@@ -169,10 +170,18 @@ sub Complete {
}
}
}
- system $tty_restore if defined $tty_restore;
+
+ # system $tty_restore if defined $tty_restore;
+ if (defined $tty_saved_state && defined $tty_restore && defined $tty_safe_restore)
+ {
+ system $tty_restore;
+ if ($?) {
+ # tty_restore caused error
+ system $tty_safe_restore;
+ }
+ }
print("\n");
$return;
}
1;
-