Skip to content

Commit

Permalink
git-svn: delay term initialization
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Wong committed Sep 14, 2014
1 parent a831a3f commit 30d45f7
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,16 @@ sub readline {
}
package main;

my $term = eval {
$ENV{"GIT_SVN_NOTTY"}
? new Term::ReadLine 'git-svn', \*STDIN, \*STDOUT
: new Term::ReadLine 'git-svn';
};
if ($@) {
$term = new FakeTerm "$@: going non-interactive";
my $term;
sub term_init {
$term = eval {
$ENV{"GIT_SVN_NOTTY"}
? new Term::ReadLine 'git-svn', \*STDIN, \*STDOUT
: new Term::ReadLine 'git-svn';
};
if ($@) {
$term = new FakeTerm "$@: going non-interactive";
}
}

my $cmd;
Expand Down Expand Up @@ -424,6 +427,7 @@ sub ask {
my $default = $arg{default};
my $resp;
my $i = 0;
term_init() unless $term;
if ( !( defined($term->IN)
&& defined( fileno($term->IN) )
Expand Down

0 comments on commit 30d45f7

Please sign in to comment.