mirror of https://bitbucket.org/ausocean/av.git
audio-player: error checking
This commit is contained in:
parent
c5fb58e70c
commit
4690209fd5
|
@ -76,14 +76,20 @@ func main() {
|
|||
cmd := exec.Command(audioCmd, *soundFilePtr)
|
||||
|
||||
var stdoutBuf, stderrBuf bytes.Buffer
|
||||
stdoutIn, _ := cmd.StdoutPipe()
|
||||
stderrIn, _ := cmd.StderrPipe()
|
||||
stdoutIn, err := cmd.StdoutPipe()
|
||||
if err != nil {
|
||||
log.Log(logger.Error, "failed to make stdout pipe", "error", err.Error())
|
||||
}
|
||||
stderrIn, err := cmd.StderrPipe()
|
||||
if err != nil {
|
||||
log.Log(logger.Error, "failed to make stderr pipe", "error", err.Error())
|
||||
}
|
||||
|
||||
var errStdout, errStderr error
|
||||
stdout := io.MultiWriter(os.Stdout, &stdoutBuf)
|
||||
stderr := io.MultiWriter(os.Stderr, &stderrBuf)
|
||||
|
||||
err := cmd.Start()
|
||||
err = cmd.Start()
|
||||
if err != nil {
|
||||
log.Log(logger.Fatal, "cmd.Start() for 'play' failed", "error", err.Error())
|
||||
}
|
||||
|
|
|
@ -22,12 +22,8 @@ func initCommand(log *logger.Logger) {
|
|||
}
|
||||
log.Log(logger.Debug, "'alsactl' executable path", "path", path)
|
||||
|
||||
for {
|
||||
cmdInit := exec.Command("alsactl", "-f", soundcardPath, "restore")
|
||||
err := cmdInit.Run()
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
cmdInit := exec.Command("alsactl", "-f", soundcardPath, "restore")
|
||||
for cmdInit.Run() != nil {
|
||||
log.Log(logger.Warning, "cmd.Run() for 'alsactl' failed", "error", err.Error())
|
||||
time.Sleep(sleepDur)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue