Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfirmDestructiveOperation ¶
ConfirmDestructiveOperation prompts the user for confirmation before a destructive operation. It returns true if the operation should proceed. The prompt is skipped (returns true) when force is set or agent mode is active.
The read honors ctx cancellation — a Ctrl-C (which the root process wires into ctx via signal.NotifyContext) unblocks the prompt with context.Canceled. Without this, the SIGINT handler would intercept the signal but the bufio read would keep blocking, leaving the user stuck until SIGKILL.
On cancellation the stdin-reader goroutine is leaked (it stays blocked on os.Stdin). That is acceptable: cancellation only happens on the way to process exit, and Go's runtime tears the goroutine down with the process.
func SetReaderForTest ¶ added in v1.14.0
SetReaderForTest overrides the confirmation input reader, returning a function that restores the previous reader. It is intended for use only from test code in other packages that need to simulate user input.
Types ¶
This section is empty.