fix(zip): missed "password:" prompt if output trails it #41364

Problem:
Flaky test:

    RUN      T1158 nvim.zip reports an incorrect archive password: 11092.84 ms FAIL

The prompt is detected only if the pty output *ends* with "password: ",
but a read may return the prompt plus following bytes.

Solution:
- Match anywhere in the output since the last password was sent. The
  buffer is cleared before each send, so won't match stale text.
- Assert on the reported message, so a failure shows what was reported.
This commit is contained in:
Justin M. Keyes
2026-08-18 06:23:59 -04:00
committed by GitHub
parent d9b4fb1273
commit c5ea9ca2ad
2 changed files with 9 additions and 7 deletions

View File

@@ -198,8 +198,8 @@ local function extract_with_password(command, source, path, dir)
local function wanted()
return exited ~= nil
or buffered:find('password: $') ~= nil
or buffered:find('reenter: $') ~= nil
or buffered:find('password: ', 1, true) ~= nil
or buffered:find('reenter: ', 1, true) ~= nil
end
local reenter = false