All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] git-svn: delay term initialization
@ 2014-09-14  8:04 Eric Wong
  2014-09-14  8:07 ` Eric Wong
  2014-09-15 18:00 ` Junio C Hamano
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Wong @ 2014-09-14  8:04 UTC (permalink / raw)
  To: git; +Cc: Eric Wong

On my Debian 7 system, this gives 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>
---
 Also, manually tested to ensure dcommit --interactive works.

 git-svn.perl | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 40565cd..ce0d7e1 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -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;
@@ -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) )
-- 
EW

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] git-svn: delay term initialization
  2014-09-14  8:04 [PATCH] git-svn: delay term initialization Eric Wong
@ 2014-09-14  8:07 ` Eric Wong
  2014-09-15 18:00 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2014-09-14  8:07 UTC (permalink / raw)
  To: git

Eric Wong <normalperson@yhbt.net> wrote:
> On my Debian 7 system, this gives annoying warnings when the output

s/gives/fixes/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] git-svn: delay term initialization
  2014-09-14  8:04 [PATCH] git-svn: delay term initialization Eric Wong
  2014-09-14  8:07 ` Eric Wong
@ 2014-09-15 18:00 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2014-09-15 18:00 UTC (permalink / raw)
  To: Eric Wong; +Cc: git

Eric Wong <normalperson@yhbt.net> writes:

> On my Debian 7 system, this gives 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>
> ---
>  Also, manually tested to ensure dcommit --interactive works.

Makes sense.

>
>  git-svn.perl | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/git-svn.perl b/git-svn.perl
> index 40565cd..ce0d7e1 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -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;
> @@ -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) )

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-15 18:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-14  8:04 [PATCH] git-svn: delay term initialization Eric Wong
2014-09-14  8:07 ` Eric Wong
2014-09-15 18:00 ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.