flags and error messages
This commit is contained in:
parent
e34f699baa
commit
1191484efa
1 changed files with 7 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"git.lattuga.net/boyska/direttoforo.git/liquidsoap"
|
||||
"os"
|
||||
|
@ -17,12 +18,15 @@ func outUI(output chan liquidsoap.Output) {
|
|||
}
|
||||
|
||||
func main() {
|
||||
liqfile := flag.String("liq", "foo.liq", "Path to liquidsoap script to run")
|
||||
flag.Parse()
|
||||
|
||||
killLs := make(chan struct{}) // when it is closed, liquidsoap will die
|
||||
killed := make(chan os.Signal, 1)
|
||||
signal.Notify(killed, os.Interrupt) // ctrl-c
|
||||
output, exit, err := liquidsoap.RunLiquidsoap("foo.liq", killLs)
|
||||
output, exit, err := liquidsoap.RunLiquidsoap(*liqfile, killLs)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
fmt.Fprintln(os.Stderr, "Error spawning liquidsoap", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
@ -51,7 +55,7 @@ func main() {
|
|||
select {
|
||||
case how := <-exit: // liquidsoap exits
|
||||
if !how.Success() {
|
||||
fmt.Fprintln(os.Stderr, how.Err)
|
||||
fmt.Fprintln(os.Stderr, "liquidsoap terminated,", how.Err)
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(0)
|
||||
|
|
Loading…
Reference in a new issue