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>
Eric Wong committed
Sep 14, 2014 at 07:38 UTC
30d45f798d1a4b14759cd977b68be4476d66ea17
1 file changed
+11
-7
git-svn.perl
+11
-7
@@ -306,13 +306,16 @@ sub readline {
306
}
307
package main;
308
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
+ }
319
}
320
321
my $cmd;
@@ -424,6 +427,7 @@ sub ask {
427
my $default = $arg{default};
428
my $resp;
429
my $i = 0;
430
+ term_init() unless $term;
431
432
if ( !( defined($term->IN)
433
&& defined( fileno($term->IN) )