use different strategy from stackoverflow

This commit is contained in:
filifa 2024-08-25 22:00:01 -05:00
parent 583a50be79
commit f0b432614d
1 changed files with 3 additions and 5 deletions

View File

@ -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)