use different strategy from stackoverflow
This commit is contained in:
parent
583a50be79
commit
f0b432614d
|
@ -47,13 +47,11 @@ func handleEvent(event sdl.Event, m *milkDropWindow) bool {
|
|||
}
|
||||
|
||||
func milkbucket(cmd *cobra.Command, args []string) {
|
||||
fi, err := os.Stdin.Stat()
|
||||
stat, err := os.Stdin.Stat()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
size := fi.Size()
|
||||
if size <= 0 {
|
||||
log.Fatal("stdin is empty")
|
||||
} else if (stat.Mode() & os.ModeCharDevice) != 0 {
|
||||
log.Fatal("nothing to read from stdin")
|
||||
}
|
||||
|
||||
err = sdl.Init(sdl.INIT_VIDEO)
|
||||
|
|
Loading…
Reference in New Issue