[svk-devel] patch to prevent failure when you don't have a tty
Mark Eichin
eichin at metacarta.com
Tue Mar 25 14:39:52 EDT 2008
Term::ReadKey::GetControlChars blows out with "Unable to read terminal
settings in GetControlChars" if STDIN is not a tty, which happens more
often than you'd think (this bit me once when trying to pipe "yes
skip" to svk, and another time when running svk in a debian-lenny
chroot without /dev/pts bindmounted.) Term::ReadKey::ReadKey and the
rest work fine on a pipe, though, once you get past the blowout (and
if you don't have a tty, you probably don't care about simulating
erase-handling anyway.)
diff -u -r1.1 Util.pm
--- Util.pm 2008/03/25 18:31:27 1.1
+++ Util.pm 2008/03/25 18:32:01
@@ -191,7 +191,7 @@
my $out = (IS_WIN32 ? sub { 1 } : sub { print @_ });
my $erase;
- if (!IS_WIN32) {
+ if (!IS_WIN32 && -t) {
my %keys = Term::ReadKey::GetControlChars();
$erase = $keys{ERASE};
}
(Of course, I'm not sure why SVK::Util::get_prompt bothers to simulate
raw line editing in the first place; it should be able to just catch
SIGINT if it wants to clean up.)
More information about the svk-devel
mailing list