Skip to content

Fix nil-pointer panic in LoginCmd.Run: guard the deferred logFile.Close( - #700

Open
jeranaias wants to merge 1 commit into
openpubkey:mainfrom
jeranaias:fix/pr-028-fix-nil-pointer-panic-in-logincm
Open

jeranaias wants to merge 1 commit into
openpubkey:mainfrom
jeranaias:fix/pr-028-fix-nil-pointer-panic-in-logincm

Conversation

@jeranaias

Copy link
Copy Markdown

Summary

Fix nil-pointer panic in LoginCmd.Run: guard the deferred logFile.Close() so it only executes when OpenFile succeeded; on failure, fall back to stdout-only logging.

Changes

  • commands/login.go

Verification

  • Verified locally via: go test -race -run (?:TestRegression)|(?:^(TestRegression_DeferredLogFileClosePanicsOnOpenFileError)$) ./commands

Disclosure: Flagged using local static/AI analysis tooling (jeranaias), then manually reviewed, reproduced with a unit test, and verified locally prior to opening this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant