Fix unloading via CLI (-u)

Squashed commit of the following:

commit 19532d64a7f7337da7f844d52198417ceaf60e80
Author: lawl <github@dumbinter.net>
Date:   Thu Feb 4 10:40:27 2021 +0100

    Fix unloading paClient for UI

commit 66ece81e17589988f92059b44b2659fdca0c4ca1
Merge: 1c97cfe 60d06f2
Author: lawl <github@dumbinter.net>
Date:   Thu Feb 4 10:36:13 2021 +0100

    Merge branch 'fix_cli_unload' of git://github.com/hador/NoiseTorch into hador-fix_cli_unload

commit 60d06f25aa
Author: andreafa <andreafa@amazon.com>
Date:   Thu Feb 4 08:51:48 2021 +0000

    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.
pull/110/head
lawl 3 years ago
parent 1c97cfe43c
commit 335b8a2567

@ -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 == "" {
@ -192,6 +196,9 @@ func main() {
}
ctx.paClient.Close()
ctx.paClient = nil
if ctx.config.EnableUpdates {
go updateCheck(&ctx)
}

Loading…
Cancel
Save