Re: [PATCH 2/2] send-email: avoid creating more than one Term::ReadLine object
From: Taylor Blau <hidden>
Date: 2023-08-08 20:58:58
On Tue, Aug 08, 2023 at 02:15:31PM -0400, Jeff King wrote:
Every time git-send-email calls its ask() function to prompt the user, we call term(), which instantiates a new Term::ReadLine object. But in v1.46 of Term::ReadLine::Gnu (which provides the Term::ReadLine interface on some platforms), its constructor refuses to create a second instance[1]. So on systems with that version of the module, most git-send-email instances will fail (as we usually prompt for both "to" and "in-reply-to" unless the user provided them on the command line).
Nice one ;-). Everything you wrote here makes sense, as does initializing the Term::ReadLine object only once.
Note that the tests in t9001 detect this problem as-is, since the failure mode is for the program to die. But let's also beef up the "Prompting works" test to check that it correctly handles multiple inputs (if we had chosen to keep our FakeTerm hack in the previous commit, then the failure mode would be incorrectly ignoring prompts after the first).
Thanks for improving the test coverage while you're here. Everything here LGTM. Thanks, Taylor