Browse Source

flags and error messages

dbz 7 years ago
parent
commit
1191484efa
1 changed files with 7 additions and 3 deletions
  1. 7 3
      cmd/direttoforo/main.go

+ 7 - 3
cmd/direttoforo/main.go

@@ -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)