support pipes

This commit is contained in:
Niklas 2019-11-04 21:26:21 +01:00
parent 8223e02e50
commit 7a6c0df33a

View File

@ -163,8 +163,11 @@ func main() {
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
if fi.Size() == 0 {
log.Fatal("stdin is empty") if fi.Mode()&os.ModeNamedPipe == 0 {
if fi.Size() == 0 {
log.Fatal("stdin is empty")
}
} }
data, err := ioutil.ReadAll(os.Stdin) data, err := ioutil.ReadAll(os.Stdin)