Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
chenjie4255 opened this issue Feb 8, 2025 · 0 comments

Comments

@chenjie4255
Copy link

When the program is running as Windows system services, the os.stdout is nil. which results in a panic.

panic: nil passed instead of *os.File to NewColorable()

goroutine 1 [running]:
github.com/mattn/go-colorable.NewColorable(0x0)
	C:/Users/chen/go/pkg/mod/github.com/mattn/[email protected]/colorable_windows.go:104 +0x3d6
github.com/mattn/go-colorable.NewColorableStdout()
	C:/Users/chen/go/pkg/mod/github.com/mattn/[email protected]/colorable_windows.go:122 +0x25
github.com/fatih/color.init()
	C:/Users/chen/go/pkg/mod/github.com/fatih/[email protected]/color.go:27 +0x12d

link issue: mattn/go-colorable#76

Maybe we need a method to avoid calling the go-colorable.NewColorableStdout() when the os.Stdout is nil?

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

No branches or pull requests

1 participant