Skip to content

Panic while a program is runing as windows system service #76

Open
@chenjie4255

Description

@chenjie4255
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/go-colorable@v0.1.13/colorable_windows.go:104 +0x3d6
github.com/mattn/go-colorable.NewColorableStdout()
	C:/Users/chen/go/pkg/mod/github.com/mattn/go-colorable@v0.1.13/colorable_windows.go:122 +0x25
github.com/fatih/color.init()
	C:/Users/chen/go/pkg/mod/github.com/fatih/color@v1.13.0/color.go:27 +0x12d

It looks like the os.Stdout may be nil in this case.

Image

It would be better if we could have a method to get around this panic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions