develooper Front page | perl.perl5.porters | Postings from September 2001

[PATCH lib/Term/Complete.t] (was Re: [ID 20010929.014] Term::Complete screws up -ixon)

Thread Previous | Thread Next
From:
chromatic
Date:
September 30, 2001 17:23
Subject:
[PATCH lib/Term/Complete.t] (was Re: [ID 20010929.014] Term::Complete screws up -ixon)
Message ID:
20011001002323.88055.qmail@onion.perl.org
In article <20011001021246.M24225@alpha.hut.fi>, "Jarkko Hietaniemi"
<jhi@iki.fi> wrote:

> I guess one could try running stty -g, if succesful (no error code), save away
> the output, and on completion restore using that.

Something like this?

-- c


--- lib/Term/~Complete.t	Sun Sep 30 18:13:15 2001
+++ lib/Term/Complete.t	Sun Sep 30 18:13:17 2001
@@ -8,6 +8,11 @@
 use warnings;
 use Test::More tests => 8;
 use vars qw( $Term::Complete::complete $complete );
+my $restore;
+
+END {
+	`stty $restore`;
+}
 
 SKIP: {
     skip('PERL_SKIP_TTY_TEST', 8) if $ENV{PERL_SKIP_TTY_TEST};
@@ -18,7 +23,9 @@
     if (defined $TTY) {
 	open(TTY, $TTY)               or die "open $TTY failed: $!";
 	skip("$TTY not a tty", 8)     if defined $TTY && ! -t TTY;
-    }
+	$restore = `stty -g`;
+	skip("Can't reliably restore $TTY", 8) if $?;
+	}
 
 use_ok( 'Term::Complete' );

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About