Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
liquidsoap controller so far
package main
import (
var cmd *exec.Cmd
var kill = make(chan bool)
func startProcess(w http.ResponseWriter, r *http.Request) {
cmd = exec.Command("liquidsoap", "test.liq")
stdout, err := cmd.StdoutPipe()
if err != nil {
fmt.Fprint(w, err)
go runCmd()
in := bufio.NewScanner(stdout)
for in.Scan() {
fmt.Fprint(w, in.Text())
if err := in.Err(); err != nil {
fmt.Fprint(w, "hahaha no I quit.")
func runCmd() {
func killProcess(w http.ResponseWriter, r *http.Request) {
kill <- true
func main() {
http.HandleFunc("/start", startProcess)
http.HandleFunc("/stop", killProcess)
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "test.html") })
http.ListenAndServe(":8080", nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.