Change 18553 by jhi@kosh on 2003/01/22 12:43:31
Subject: Term::Complete problem + fix (Was: Re: muttprofile + perl 5.8)
From: Martti Rahkila <[EMAIL PROTECTED]>
Date: Sat, 18 Jan 2003 00:25:39 +0200
Message-ID: <[EMAIL PROTECTED]>
(chose the 'even safer' version)
Affected files ...
... //depot/perl/lib/Term/Complete.pm#15 edit
Differences ...
==== //depot/perl/lib/Term/Complete.pm#15 (text) ====
Index: perl/lib/Term/Complete.pm
--- perl/lib/Term/Complete.pm#14~18343~ Sun Dec 22 21:47:17 2002
+++ perl/lib/Term/Complete.pm Wed Jan 22 04:43:31 2003
@@ -5,7 +5,7 @@
use strict;
our @ISA = qw(Exporter);
our @EXPORT = qw(Complete);
-our $VERSION = '1.4';
+our $VERSION = '1.401';
# @(#)complete.pl,v1.2 ([EMAIL PROTECTED]) 09/23/91
@@ -66,7 +66,7 @@
=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 @@
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 @@
$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 @@
}
}
}
- 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;
-
End of Patch.