handle eof
This commit is contained in:
parent
5bba14b556
commit
59bebc7e00
6
main.go
6
main.go
|
@ -11,6 +11,7 @@ import "C"
|
|||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"io"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
@ -61,7 +62,10 @@ func main() {
|
|||
audioData := make([]int16, bufSize)
|
||||
|
||||
err = binary.Read(os.Stdin, binary.LittleEndian, audioData)
|
||||
if err != nil {
|
||||
if err == io.ErrUnexpectedEOF {
|
||||
running = false
|
||||
break
|
||||
} else if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue