From 60d06f25aacc78fe3f0c8174ab8f6bf4610314eb Mon Sep 17 00:00:00 2001 From: andreafa Date: Thu, 4 Feb 2021 08:51:48 +0000 Subject: [PATCH] Fix cli unload (-u). The findModule method in module.go requires a valid paClient to be populated in the context object. Added logging if unloadSupressor fails when called via the -u CLI flag. --- main.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 7af98b1..7a66aaa 100644 --- a/main.go +++ b/main.go @@ -107,6 +107,8 @@ func main() { os.Exit(1) } + ctx.paClient = paClient + if list { fmt.Println("Sources:") sources := getSources(paClient) @@ -133,12 +135,15 @@ func main() { } if unload { - unloadSupressor(&ctx) + err := unloadSupressor(&ctx) + if err != nil { + fmt.Fprintf(os.Stderr, "Error unloading PulseAudio Module: %+v\n", err) + os.Exit(1) + } os.Exit(0) } if loadInput { - ctx.paClient = paClient sources := getSources(paClient) if sinkName == "" { @@ -165,7 +170,6 @@ func main() { } if loadOutput { - ctx.paClient = paClient sinks := getSinks(paClient) if sinkName == "" {