From 5b37a6b04b6a844544e323fbefd3ebfb2f8b13f6 Mon Sep 17 00:00:00 2001 From: Akshat Sinha Date: Mon, 13 Oct 2025 20:18:23 +0530 Subject: [PATCH] fix(cli): handle error when writing password prompt and correct spelling (i) Add error handling for fmt.Fprint when writing password prompt to stdout (ii) Fixed : initalization to initialization in the commented region Signed-off-by: Akshat Sinha --- cmd/flux/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/flux/main.go b/cmd/flux/main.go index b6627caa..815edb17 100644 --- a/cmd/flux/main.go +++ b/cmd/flux/main.go @@ -180,7 +180,7 @@ func main() { // This is required because controller-runtime expects its consumers to // set a logger through log.SetLogger within 30 seconds of the program's - // initalization. If not set, the entire debug stack is printed as an + // initialization. If not set, the entire debug stack is printed as an // error, see: https://github.com/kubernetes-sigs/controller-runtime/blob/ed8be90/pkg/log/log.go#L59 // Since we have our own logging and don't care about controller-runtime's // logger, we configure it's logger to do nothing. @@ -225,7 +225,9 @@ func configureDefaultNamespace() { func readPasswordFromStdin(prompt string) (string, error) { var out string var err error - fmt.Fprint(os.Stdout, prompt) + if _, err := fmt.Fprint(os.Stdout, prompt); err != nil { + return "", fmt.Errorf("failed to write prompt: %w", err) + } stdinFD := int(os.Stdin.Fd()) if term.IsTerminal(stdinFD) { var inBytes []byte