Skip to content

Commit 30d45f7

Browse files
author
Eric Wong
committed
git-svn: delay term initialization
On my Debian 7 system, this fixes annoying warnings when the output of "git svn" commands are redirected: Unable to get Terminal Size. The TIOCGWINSZ ioctl didn't work. The COLUMNS and LINES environment variables didn't work. The resize program didn't work. Signed-off-by: Eric Wong <normalperson@yhbt.net>
1 parent a831a3f commit 30d45f7

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

git-svn.perl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,16 @@ sub readline {
306306
}
307307
package main;
308308

309-
my $term = eval {
310-
$ENV{"GIT_SVN_NOTTY"}
311-
? new Term::ReadLine 'git-svn', \*STDIN, \*STDOUT
312-
: new Term::ReadLine 'git-svn';
313-
};
314-
if ($@) {
315-
$term = new FakeTerm "$@: going non-interactive";
309+
my $term;
310+
sub term_init {
311+
$term = eval {
312+
$ENV{"GIT_SVN_NOTTY"}
313+
? new Term::ReadLine 'git-svn', \*STDIN, \*STDOUT
314+
: new Term::ReadLine 'git-svn';
315+
};
316+
if ($@) {
317+
$term = new FakeTerm "$@: going non-interactive";
318+
}
316319
}
317320

318321
my $cmd;
@@ -424,6 +427,7 @@ sub ask {
424427
my $default = $arg{default};
425428
my $resp;
426429
my $i = 0;
430+
term_init() unless $term;
427431
428432
if ( !( defined($term->IN)
429433
&& defined( fileno($term->IN) )

0 commit comments

Comments
 (0)