term.ReadPassword reads the terminal with a raw read that returns 0 bytes at the end of input and takes that as nothing yet, so Ctrl-D at the prompt did nothing. On the Unix systems the prompt now sets the terminal as ReadPassword does and reads the line from standard input, which reports the end of input; elsewhere, such as Windows, it still uses ReadPassword. Ctrl-D with nothing typed gives an empty mnemonic, refused with status 1, and the terminal settings are put back. A test types Ctrl-D at the prompt on a pseudo-terminal. Unverified: the prompt was run only on Linux; other systems were built. Deviation: a Ctrl-H byte is no longer a backspace at the prompt. Model: opus-5-5 Co-authored-by: clawbot <sneak+clawbot@sneak.cloud>
This commit was merged in pull request #90.
This commit is contained in:
@@ -116,7 +116,11 @@ order; the first one found wins:
|
||||
2. Environment variable `KEYFUNC_MNEMONIC_COMMAND`: the same, as a shell command
|
||||
held in the environment.
|
||||
3. Environment variable `KEYFUNC_MNEMONIC`: the mnemonic itself.
|
||||
4. A prompt on the terminal with echo turned off.
|
||||
4. A prompt on the terminal with echo turned off. The mnemonic is what is typed
|
||||
up to Enter, and echo is turned back on once it is read. Ctrl-D with nothing
|
||||
typed ends the prompt at once and leaves the mnemonic empty, so the tool
|
||||
refuses it and exits with status 1. After text has been typed, Ctrl-D has to
|
||||
be pressed twice to end the prompt, and the text typed is the mnemonic.
|
||||
|
||||
If none of these is available and standard input is not a terminal, the tool
|
||||
refuses and exits with status 1. A mnemonic that is empty, does not have 12, 15,
|
||||
|
||||
Reference in New Issue
Block a user