fix(tui): short-circuit wizard.Run on cancelled context before opening TTY
This commit is contained in:
@@ -17,6 +17,11 @@ import (
|
||||
func Run(ctx context.Context, reg *module.Registry, initial tui.WizardState) (tui.WizardState, bool, error) {
|
||||
s := initial
|
||||
|
||||
// Honour an already-cancelled context before Huh tries to open /dev/tty.
|
||||
if err := ctx.Err(); err != nil {
|
||||
return s, false, nil
|
||||
}
|
||||
|
||||
themeOptions := make([]huh.Option[string], 0, len(tui.BuiltinThemes))
|
||||
for _, t := range tui.BuiltinThemes {
|
||||
themeOptions = append(themeOptions, huh.NewOption(t.Name, t.ID))
|
||||
|
||||
Reference in New Issue
Block a user