Skip to content

fix: add nil check for os.Stdout to prevent panic on Windows services#275

Open
majiayu000 wants to merge 1 commit intofatih:mainfrom
majiayu000:fix-250-need-a-method-to-avoid-the-pan-0101-1659
Open

fix: add nil check for os.Stdout to prevent panic on Windows services#275
majiayu000 wants to merge 1 commit intofatih:mainfrom
majiayu000:fix-250-need-a-method-to-avoid-the-pan-0101-1659

Conversation

@majiayu000
Copy link

Fixes #250

Changes

  • Add nil check in stdoutIsTerminal() before calling os.Stdout.Fd()
  • Add initOutput() to safely initialize Output with nil check for os.Stdout
  • Add initError() to safely initialize Error with nil check for os.Stderr
  • Add nil check in color_windows.go init() before accessing os.Stdout.Fd()

Signed-off-by: majiayu000 <1835304752@qq.com>
fatih pushed a commit that referenced this pull request Feb 1, 2026
Comprehensive analysis of open issues and PRs with prioritization:
- Critical: Windows service panic fix (PR #275), new release needed
- High: VS Code color detection issues, NO_COLOR runtime behavior
- Medium: tabwriter compatibility docs, hyperlink support, performance opt
- Maintenance: 4 dependabot PRs pending

https://claude.ai/code/session_01YJ5Uw2RTABLo4Cx4Jmzmua
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.

Need a method to avoid the panic when os.Stdout is nil on windows platform.

1 participant