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) {
|
func milkbucket(cmd *cobra.Command, args []string) {
|
||||||
fi, err := os.Stdin.Stat()
|
stat, err := os.Stdin.Stat()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
} else if (stat.Mode() & os.ModeCharDevice) != 0 {
|
||||||
size := fi.Size()
|
log.Fatal("nothing to read from stdin")
|
||||||
if size <= 0 {
|
|
||||||
log.Fatal("stdin is empty")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = sdl.Init(sdl.INIT_VIDEO)
|
err = sdl.Init(sdl.INIT_VIDEO)
|
||||||
|
|
Loading…
Reference in New Issue