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