End the mnemonic prompt at end of input (closes #78)
check / check (push) Waiting to run

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:
2026-10-14 23:35:24 +02:00
committed by clawbot
parent 2fbc32fe75
commit a08eb28359
9 changed files with 184 additions and 4 deletions
+2 -2
View File
@@ -136,7 +136,7 @@ func ask() (string, error) {
fmt.Fprint(os.Stderr, "mnemonic: ")
typed, err := term.ReadPassword(fd)
typed, err := readWithoutEcho()
fmt.Fprintln(os.Stderr)
@@ -144,7 +144,7 @@ func ask() (string, error) {
return "", fmt.Errorf("reading the mnemonic: %w", err)
}
return checked(string(typed))
return checked(typed)
}
// checked joins the words with single spaces, whatever whitespace