[[PATCH v2]] Fix bug when more than one readline instance is used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A followup[^1] for git-svn.perl on d42e4ca9f8 where this bug was solved
for git-send-email.perl

[^1]: https://lore.kernel.org/git/20230810004956.GA816605@xxxxxxxxxxxxxxxxxxxxxxx/T/#t

Signed-off-by: Wesley Schwengle <wesleys@xxxxxxxxxxxxxxx>
---
 git-svn.perl | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index be987e316f..93f6538d61 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -297,27 +297,18 @@ sub _req_svn {
 		{} ],
 );
 
-package FakeTerm;
-sub new {
-	my ($class, $reason) = @_;
-	return bless \$reason, shift;
-}
-sub readline {
-	my $self = shift;
-	die "Cannot use readline on FakeTerm: $$self";
-}
 package main;
 
-my $term;
-sub term_init {
-	$term = eval {
+{
+	my $term;
+	sub term_init {
+		return $term if $term;
 		require Term::ReadLine;
-		$ENV{"GIT_SVN_NOTTY"}
-			? new Term::ReadLine 'git-svn', \*STDIN, \*STDOUT
-			: new Term::ReadLine 'git-svn';
-	};
-	if ($@) {
-		$term = new FakeTerm "$@: going non-interactive";
+		$term = $ENV{"GIT_SVN_NOTTY"}
+				? new Term::ReadLine 'git-svn', \*STDIN, \*STDOUT
+				: new Term::ReadLine 'git-svn';
+		};
+		return $term;
 	}
 }
 
-- 
2.42.0.rc0.26.ga73c38ecaa




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux