For #91: a SIGINT, SIGTERM or SIGHUP at the mnemonic prompt ended the tool with echo still off.
readWithoutEcho in internal/mnemonic/prompt_unix.go now catches the three signals with signals.Notify before it turns echo off, and reads the line in a goroutine. Once the line is read or a signal comes, it puts the terminal back and stops catching, then checks whether a signal came by then, as replace in internal/cli/age/age.go does. One that did is sent to the tool again; with nothing catching it, it ends the tool as before (130 for SIGINT in a shell).
internal/cli/signals moves to internal/signals, since the mnemonic prompt now uses it as well; the README's Design list and the package doc say so. The package doc also says that Go keeps an inherited ignore only for SIGHUP and SIGINT, so a SIGTERM ignored at start is not left ignored, and the docs of Context and caught no longer say otherwise.
The new test in internal/cli/prompt_test.go sends SIGINT once echo is off and shares its setup with the Ctrl-D test through prompted. The README's "Errors" section and the doc comment on cli.Main say the terminal is put back.
Judgement call: the signal is sent again rather than exiting with status 130, so a parent process sees the tool ended by it.
Unchanged: the Windows prompt, which uses term.ReadPassword.
Unverified: the prompt was run only on Linux; the other systems were only built.
Untested: a signal that comes just as the line is read; no test can bring that about.
Model: opus-5-5
For https://git.eeqj.de/sneak/keyfunc/issues/91: a SIGINT, SIGTERM or SIGHUP at the mnemonic prompt ended the tool with echo still off.
`readWithoutEcho` in `internal/mnemonic/prompt_unix.go` now catches the three signals with `signals.Notify` before it turns echo off, and reads the line in a goroutine. Once the line is read or a signal comes, it puts the terminal back and stops catching, then checks whether a signal came by then, as `replace` in `internal/cli/age/age.go` does. One that did is sent to the tool again; with nothing catching it, it ends the tool as before (130 for SIGINT in a shell).
`internal/cli/signals` moves to `internal/signals`, since the mnemonic prompt now uses it as well; the README's Design list and the package doc say so. The package doc also says that Go keeps an inherited ignore only for SIGHUP and SIGINT, so a SIGTERM ignored at start is not left ignored, and the docs of `Context` and `caught` no longer say otherwise.
The new test in `internal/cli/prompt_test.go` sends SIGINT once echo is off and shares its setup with the Ctrl-D test through `prompted`. The README's "Errors" section and the doc comment on `cli.Main` say the terminal is put back.
- Judgement call: the signal is sent again rather than exiting with status 130, so a parent process sees the tool ended by it.
- Unchanged: the Windows prompt, which uses `term.ReadPassword`.
- Unverified: the prompt was run only on Linux; the other systems were only built.
- Untested: a signal that comes just as the line is read; no test can bring that about.
Model: opus-5-5
readWithoutEcho in internal/mnemonic/prompt_unix.go: a signal that arrives just as the typed line is read is caught and then dropped, so the tool carries on with the command (prints the key, starts ssh) instead of ending. It happens when the select takes the finished read over a signal that came at the same moment, and when the signal is caught after the read but before the deferred signal.Stop. On next such a signal always ends the tool, and the README says it does. Acceptable: once the line is read, stop catching and, if a signal came in the meantime, put the terminal back and end the tool by it, the way replace in internal/cli/age/age.go checks received after signal.Stop.
Model: opus-5-5
Review of https://git.eeqj.de/sneak/keyfunc/pulls/92: needs rework.
1. `readWithoutEcho` in `internal/mnemonic/prompt_unix.go`: a signal that arrives just as the typed line is read is caught and then dropped, so the tool carries on with the command (prints the key, starts `ssh`) instead of ending. It happens when the `select` takes the finished read over a signal that came at the same moment, and when the signal is caught after the read but before the deferred `signal.Stop`. On `next` such a signal always ends the tool, and the README says it does. Acceptable: once the line is read, stop catching and, if a signal came in the meantime, put the terminal back and end the tool by it, the way `replace` in `internal/cli/age/age.go` checks `received` after `signal.Stop`.
Model: opus-5-5
Rework: readWithoutEcho now puts the terminal back and stops catching once the line is read or a signal comes, then ends the tool by any signal that came by that time, as replace in internal/cli/age/age.go does, so a signal that arrives just as the line is read is no longer dropped. There is no test for that moment, since no test can bring it about on demand.
Model: opus-5-5
Rework: `readWithoutEcho` now puts the terminal back and stops catching once the line is read or a signal comes, then ends the tool by any signal that came by that time, as `replace` in `internal/cli/age/age.go` does, so a signal that arrives just as the line is read is no longer dropped. There is no test for that moment, since no test can bring it about on demand.
Model: opus-5-5
internal/mnemonic/prompt_unix.go imports internal/cli/signals. The README's Design section and the package's own doc place cli/signals inside internal/cli, the command tree, catching the signals for the commands that clean up before they end. internal/mnemonic is one of the packages the commands are built on, so it now reaches up into the command tree, and neither document says the prompt uses the package. Acceptable: the package moved to internal/signals, its three other importers changed to match, and the README's Design list and the package doc saying the mnemonic prompt uses it as well.
Unverified: the prompt was run only on Linux; the other systems were only built.
Judgement call: a SIGTERM the tool was started with set to be ignored still ends it, as on next, because Go does not keep an inherited ignore for SIGTERM; not counted against this PR.
Model: opus-5-5
Review of https://git.eeqj.de/sneak/keyfunc/pulls/92: needs rework.
1. `internal/mnemonic/prompt_unix.go` imports `internal/cli/signals`. The README's Design section and the package's own doc place `cli/signals` inside `internal/cli`, the command tree, catching the signals for the commands that clean up before they end. `internal/mnemonic` is one of the packages the commands are built on, so it now reaches up into the command tree, and neither document says the prompt uses the package. Acceptable: the package moved to `internal/signals`, its three other importers changed to match, and the README's Design list and the package doc saying the mnemonic prompt uses it as well.
- Unverified: the prompt was run only on Linux; the other systems were only built.
- Judgement call: a SIGTERM the tool was started with set to be ignored still ends it, as on `next`, because Go does not keep an inherited ignore for SIGTERM; not counted against this PR.
Model: opus-5-5
A SIGINT, SIGTERM or SIGHUP at the mnemonic prompt killed the tool
with echo still off. The prompt now catches them with signals.Notify
from before echo goes off, and reads the line in a goroutine. Once the
line is read or a signal arrives, it puts the terminal settings back
and stops catching; if a signal has arrived by then, it sends the tool
the same signal again, so the tool is still ended by it (130 for SIGINT
in a shell). A test sends SIGINT at the prompt on a pseudo-terminal.
The signals package moves from internal/cli to internal/signals, since
the mnemonic prompt now uses it as well.
Unchanged: the Windows prompt, which uses term.ReadPassword.
Model: opus-5-5
Rework: internal/cli/signals moved to internal/signals, its importers changed to match, and the README's Design list and the package doc now say the mnemonic prompt uses it as well. The package doc also says that Go keeps an inherited ignore only for SIGHUP and SIGINT, so a SIGTERM ignored at start is not left ignored; the docs of Context and caught no longer say otherwise.
Model: opus-5-5
Rework: `internal/cli/signals` moved to `internal/signals`, its importers changed to match, and the README's Design list and the package doc now say the mnemonic prompt uses it as well. The package doc also says that Go keeps an inherited ignore only for SIGHUP and SIGINT, so a SIGTERM ignored at start is not left ignored; the docs of `Context` and `caught` no longer say otherwise.
Model: opus-5-5
Unverified: the prompt was run only on Linux; the other systems were only built.
Model: opus-5-5
Review of https://git.eeqj.de/sneak/keyfunc/pulls/92: passed.
- Unverified: the prompt was run only on Linux; the other systems were only built.
Model: opus-5-5
clawbot
merged commit 8bb3d949d9 into next2026-10-15 01:35:43 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
For #91: a SIGINT, SIGTERM or SIGHUP at the mnemonic prompt ended the tool with echo still off.
readWithoutEchoininternal/mnemonic/prompt_unix.gonow catches the three signals withsignals.Notifybefore it turns echo off, and reads the line in a goroutine. Once the line is read or a signal comes, it puts the terminal back and stops catching, then checks whether a signal came by then, asreplaceininternal/cli/age/age.godoes. One that did is sent to the tool again; with nothing catching it, it ends the tool as before (130 for SIGINT in a shell).internal/cli/signalsmoves tointernal/signals, since the mnemonic prompt now uses it as well; the README's Design list and the package doc say so. The package doc also says that Go keeps an inherited ignore only for SIGHUP and SIGINT, so a SIGTERM ignored at start is not left ignored, and the docs ofContextandcaughtno longer say otherwise.The new test in
internal/cli/prompt_test.gosends SIGINT once echo is off and shares its setup with the Ctrl-D test throughprompted. The README's "Errors" section and the doc comment oncli.Mainsay the terminal is put back.term.ReadPassword.Model: opus-5-5
Review of #92: needs rework.
readWithoutEchoininternal/mnemonic/prompt_unix.go: a signal that arrives just as the typed line is read is caught and then dropped, so the tool carries on with the command (prints the key, startsssh) instead of ending. It happens when theselecttakes the finished read over a signal that came at the same moment, and when the signal is caught after the read but before the deferredsignal.Stop. Onnextsuch a signal always ends the tool, and the README says it does. Acceptable: once the line is read, stop catching and, if a signal came in the meantime, put the terminal back and end the tool by it, the wayreplaceininternal/cli/age/age.gochecksreceivedaftersignal.Stop.Model: opus-5-5
a6a9c7b18eto5df9dc098dRework:
readWithoutEchonow puts the terminal back and stops catching once the line is read or a signal comes, then ends the tool by any signal that came by that time, asreplaceininternal/cli/age/age.godoes, so a signal that arrives just as the line is read is no longer dropped. There is no test for that moment, since no test can bring it about on demand.Model: opus-5-5
Review of #92: needs rework.
internal/mnemonic/prompt_unix.goimportsinternal/cli/signals. The README's Design section and the package's own doc placecli/signalsinsideinternal/cli, the command tree, catching the signals for the commands that clean up before they end.internal/mnemonicis one of the packages the commands are built on, so it now reaches up into the command tree, and neither document says the prompt uses the package. Acceptable: the package moved tointernal/signals, its three other importers changed to match, and the README's Design list and the package doc saying the mnemonic prompt uses it as well.next, because Go does not keep an inherited ignore for SIGTERM; not counted against this PR.Model: opus-5-5
5df9dc098dtoc3cc26c721Rework:
internal/cli/signalsmoved tointernal/signals, its importers changed to match, and the README's Design list and the package doc now say the mnemonic prompt uses it as well. The package doc also says that Go keeps an inherited ignore only for SIGHUP and SIGINT, so a SIGTERM ignored at start is not left ignored; the docs ofContextandcaughtno longer say otherwise.Model: opus-5-5
Review of #92: passed.
Model: opus-5-5